Documentation
¶
Index ¶
- type APIError
- type Client
- type Connection
- type ConnectionRequest
- type ConnectionsService
- type FraudPolicy
- type FraudPolicyInput
- type FraudService
- type Option
- type Payment
- type PaymentIntentRequest
- type PaymentRouteAttempt
- type PaymentSummary
- type PaymentsService
- func (s *PaymentsService) Cancel(ctx context.Context, paymentID string) (*Payment, error)
- func (s *PaymentsService) Confirm(ctx context.Context, paymentID string) (*Payment, error)
- func (s *PaymentsService) CreateIntent(ctx context.Context, req *PaymentIntentRequest, opts ...RequestOption) (*Payment, error)
- func (s *PaymentsService) Get(ctx context.Context, paymentID string) (*Payment, error)
- func (s *PaymentsService) List(ctx context.Context, limit, offset int) ([]PaymentSummary, error)
- type RequestOption
- type RoutingHints
- type Subscription
- type SubscriptionRequest
- type SubscriptionsService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Services
Payments *PaymentsService
Connections *ConnectionsService
Subscriptions *SubscriptionsService
Fraud *FraudService
// contains filtered or unexported fields
}
Client is the Reevit API client.
type Connection ¶
type Connection struct {
ID string `json:"id"`
Provider string `json:"provider"`
Mode string `json:"mode"`
Status string `json:"status"`
Capabilities map[string]interface{} `json:"capabilities"`
RoutingHints *RoutingHints `json:"routing_hints"`
Labels []string `json:"labels"`
}
Connection represents a connection object.
type ConnectionRequest ¶
type ConnectionRequest struct {
Provider string `json:"provider"`
Mode string `json:"mode"`
Credentials map[string]interface{} `json:"credentials"`
Capabilities map[string]interface{} `json:"capabilities,omitempty"`
RoutingHints *RoutingHints `json:"routing_hints,omitempty"`
Labels []string `json:"labels,omitempty"`
}
ConnectionRequest represents a request to create a connection.
type ConnectionsService ¶
type ConnectionsService service
ConnectionsService handles communication with the connection related methods of the Reevit API.
func (*ConnectionsService) Create ¶
func (s *ConnectionsService) Create(ctx context.Context, req *ConnectionRequest) (*Connection, error)
Create creates a new connection.
API Docs: POST /v1/connections
func (*ConnectionsService) List ¶
func (s *ConnectionsService) List(ctx context.Context) ([]Connection, error)
List returns a list of connections.
API Docs: GET /v1/connections
func (*ConnectionsService) Test ¶
func (s *ConnectionsService) Test(ctx context.Context, req *ConnectionRequest) (bool, error)
Test tests a connection.
API Docs: POST /v1/connections/test
type FraudPolicy ¶
type FraudPolicy struct {
Prefer []string `json:"prefer"`
MaxAmount int64 `json:"max_amount"`
BlockedBins []string `json:"blocked_bins"`
AllowedBins []string `json:"allowed_bins"`
VelocityMaxPerMinute int `json:"velocity_max_per_minute"`
}
FraudPolicy represents the fraud policy configuration.
type FraudPolicyInput ¶
type FraudPolicyInput struct {
Prefer []string `json:"prefer,omitempty"`
MaxAmount int64 `json:"max_amount,omitempty"`
BlockedBins []string `json:"blocked_bins,omitempty"`
AllowedBins []string `json:"allowed_bins,omitempty"`
VelocityMaxPerMinute int `json:"velocity_max_per_minute,omitempty"`
}
FraudPolicyInput represents the fraud policy configuration for a payment.
type FraudService ¶
type FraudService service
FraudService handles communication with the fraud policy related methods of the Reevit API.
func (*FraudService) Get ¶
func (s *FraudService) Get(ctx context.Context) (*FraudPolicy, error)
Get retrieves the current fraud policy.
API Docs: GET /v1/policies/fraud
func (*FraudService) Update ¶
func (s *FraudService) Update(ctx context.Context, policy *FraudPolicy) (*FraudPolicy, error)
Update updates the fraud policy.
API Docs: POST /v1/policies/fraud
type Option ¶
type Option func(*Client)
Option is a functional option for configuring the Client.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for requests.
type Payment ¶
type Payment struct {
ID string `json:"id"`
ConnectionID string `json:"connection_id"`
Provider string `json:"provider"`
ProviderRefID string `json:"provider_ref_id"`
Method string `json:"method"`
Status string `json:"status"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
FeeAmount int64 `json:"fee_amount"`
FeeCurrency string `json:"fee_currency"`
NetAmount int64 `json:"net_amount"`
CustomerID string `json:"customer_id"`
Metadata map[string]interface{} `json:"metadata"`
Route []PaymentRouteAttempt `json:"route"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Payment represents a payment object.
type PaymentIntentRequest ¶
type PaymentIntentRequest struct {
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Method string `json:"method"`
Country string `json:"country"`
CustomerID string `json:"customer_id,omitempty"`
Policy *FraudPolicyInput `json:"policy,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
PaymentIntentRequest represents a request to create a payment intent.
type PaymentRouteAttempt ¶
type PaymentRouteAttempt struct {
ConnectionID string `json:"connection_id"`
Provider string `json:"provider"`
Status string `json:"status"`
Error string `json:"error"`
Labels []string `json:"labels"`
RoutingHints *RoutingHints `json:"routing_hints"`
}
PaymentRouteAttempt represents a routing attempt.
type PaymentSummary ¶
type PaymentSummary struct {
ID string `json:"id"`
ConnectionID string `json:"connection_id"`
Provider string `json:"provider"`
Method string `json:"method"`
Status string `json:"status"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
FeeAmount int64 `json:"fee_amount"`
FeeCurrency string `json:"fee_currency"`
NetAmount int64 `json:"net_amount"`
CustomerID string `json:"customer_id"`
Metadata map[string]interface{} `json:"metadata"`
CreatedAt time.Time `json:"created_at"`
}
PaymentSummary represents a summary of a payment object.
type PaymentsService ¶
type PaymentsService service
PaymentsService handles communication with the payment related methods of the Reevit API.
func (*PaymentsService) Cancel ¶
Cancel cancels a payment intent.
API Docs: POST /v1/payments/{id}/cancel
func (*PaymentsService) Confirm ¶
Confirm confirms a payment after PSP callback.
API Docs: POST /v1/payments/{id}/confirm
func (*PaymentsService) CreateIntent ¶
func (s *PaymentsService) CreateIntent(ctx context.Context, req *PaymentIntentRequest, opts ...RequestOption) (*Payment, error)
CreateIntent creates a new payment intent.
API Docs: POST /v1/payments/intents
func (*PaymentsService) List ¶
func (s *PaymentsService) List(ctx context.Context, limit, offset int) ([]PaymentSummary, error)
List returns a list of payments.
API Docs: GET /v1/payments
type RequestOption ¶
RequestOption is a functional option for configuring API requests.
func WithIdempotencyKey ¶
func WithIdempotencyKey(key string) RequestOption
WithIdempotencyKey sets the idempotency key for the request.
type RoutingHints ¶
type RoutingHints struct {
CountryPreference []string `json:"country_preference"`
MethodBias map[string]string `json:"method_bias"`
FallbackOnly bool `json:"fallback_only"`
}
RoutingHints represents routing preferences.
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
OrgID string `json:"org_id"`
CustomerID string `json:"customer_id"`
PlanID string `json:"plan_id"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Method string `json:"method"`
Interval string `json:"interval"`
Status string `json:"status"` // active, paused, canceled
NextRenewalAt time.Time `json:"next_renewal_at"`
Metadata map[string]interface{} `json:"metadata"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Subscription represents a subscription object.
type SubscriptionRequest ¶
type SubscriptionRequest struct {
CustomerID string `json:"customer_id"`
PlanID string `json:"plan_id"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Method string `json:"method"`
Interval string `json:"interval"` // monthly, yearly
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
SubscriptionRequest represents a request to create a subscription.
type SubscriptionsService ¶
type SubscriptionsService service
SubscriptionsService handles communication with the subscription related methods of the Reevit API.
func (*SubscriptionsService) Create ¶
func (s *SubscriptionsService) Create(ctx context.Context, req *SubscriptionRequest) (*Subscription, error)
Create creates a new subscription.
API Docs: POST /v1/subscriptions
func (*SubscriptionsService) List ¶
func (s *SubscriptionsService) List(ctx context.Context) ([]Subscription, error)
List returns a list of subscriptions.
API Docs: GET /v1/subscriptions