Documentation ¶
Index ¶
- Variables
- type AutomatedEVMSubscription
- type CheckoutSession
- type CheckoutSessionRequest
- type CheckoutSessionResponse
- type Client
- type Data
- type EventData
- type Gateway
- type InstrumentedClient
- type KeyValue
- type LineItem
- type Managed
- type ManagedRecurringPayment
- type Metadata
- type Method
- type MockClient
- type NewSubscriptionData
- type Subscription
- type WebhookRequest
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidMetadataKey = errors.New("invalid metadata key")
)
Functions ¶
This section is empty.
Types ¶
type AutomatedEVMSubscription ¶
type AutomatedEVMSubscription struct { BuyerAddress string `json:"buyerAddress"` SubscriptionContractAddress string `json:"subscriptionContractAddress"` }
AutomatedEVMSubscripton defines an automated subscription
type CheckoutSession ¶
type CheckoutSession struct { CheckoutSessionID string `json:"checkoutSessionId"` Metadata Metadata `json:"metadata"` }
CheckoutSession describes a radom checkout session
type CheckoutSessionRequest ¶
type CheckoutSessionRequest struct { SuccessURL string `json:"successUrl"` CancelURL string `json:"cancelUrl"` Currency string `json:"currency"` ExpiresAt int64 `json:"expiresAt"` // in unix seconds LineItems []LineItem `json:"lineItems"` Metadata Metadata `json:"metadata"` Customizations map[string]interface{} `json:"customizations"` Total decimal.Decimal `json:"total"` Gateway Gateway `json:"gateway"` }
CheckoutSessionRequest represents a request to create a checkout session.
type CheckoutSessionResponse ¶
type CheckoutSessionResponse struct { SessionID string `json:"checkoutSessionId"` SessionURL string `json:"checkoutSessionUrl"` }
CheckoutSessionResponse represents the result of submission of a checkout session.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with Radom.
func (*Client) CreateCheckoutSession ¶
func (c *Client) CreateCheckoutSession( ctx context.Context, req *CheckoutSessionRequest, ) (*CheckoutSessionResponse, error)
CreateCheckoutSession creates a Radom checkout session.
type Data ¶
type Data struct {
CheckoutSession CheckoutSession `json:"checkoutSession"`
}
Data is radom specific data attached to webhook calls
type EventData ¶
type EventData struct { ManagedRecurringPayment *ManagedRecurringPayment `json:"managedRecurringPayment"` NewSubscription *NewSubscriptionData `json:"newSubscription"` }
EventData encapsulates the webhook event
type Gateway ¶
type Gateway struct {
Managed Managed `json:"managed"`
}
Gateway provides access to managed services configurations
type InstrumentedClient ¶
type InstrumentedClient struct {
// contains filtered or unexported fields
}
func NewInstrumented ¶
func NewInstrumented(srvURL, secret, proxyAddr string) (*InstrumentedClient, error)
func (*InstrumentedClient) CreateCheckoutSession ¶
func (_d *InstrumentedClient) CreateCheckoutSession(ctx context.Context, cp1 *CheckoutSessionRequest) (cp2 *CheckoutSessionResponse, err error)
type LineItem ¶
type LineItem struct { ProductID string `json:"productId"` ItemData map[string]interface{} `json:"itemData"` }
LineItem is a line item for a checkout session request.
type Managed ¶
type Managed struct {
Methods []Method `json:"methods"`
}
Managed is the Radom managed services configuration
type ManagedRecurringPayment ¶
type ManagedRecurringPayment struct { PaymentMethod Method `json:"paymentMethod"` Amount decimal.Decimal `json:"amount"` }
ManagedRecurringPayment provides details about the recurring payment from webhook
type Metadata ¶
type Metadata []KeyValue
Metadata represents metaadata in a checkout session request.
type MockClient ¶
type MockClient struct {
FnCreateCheckoutSession func(ctx context.Context, req *CheckoutSessionRequest) (*CheckoutSessionResponse, error)
}
func (*MockClient) CreateCheckoutSession ¶
func (c *MockClient) CreateCheckoutSession( ctx context.Context, req *CheckoutSessionRequest, ) (*CheckoutSessionResponse, error)
type NewSubscriptionData ¶
type NewSubscriptionData struct { SubscriptionID string `json:"subscriptionId"` Subscription Subscription `json:"subscriptionType"` Network string `json:"network"` Token string `json:"token"` Amount decimal.Decimal `json:"amount"` Currency string `json:"currency"` Period string `json:"period"` PeriodCustomDuration string `json:"periodCustomDuration"` CreatedAt *time.Time `json:"createdAt"` Tags map[string]string `json:"tags"` }
NewSubscriptionData provides details about the new subscription
type Subscription ¶
type Subscription struct {
AutomatedEVMSubscription AutomatedEVMSubscription `json:"automatedEVMSubscription"`
}
Subscription is a radom subscription
type WebhookRequest ¶
type WebhookRequest struct { EventType string `json:"eventType"` EventData EventData `json:"eventData"` Data Data `json:"radomData"` }
WebhookRequest represents a radom webhook submission