Documentation ¶
Overview ¶
Package client provides support to access the Selcom Pay API service.
Index ¶
- func WithClient(http *http.Client) func(cln *Client)
- type CardPaymentInput
- type Client
- func (cln *Client) CancelOrder(ctx context.Context, orderID string) (Response, error)
- func (cln *Client) CardPayment(ctx context.Context, cardPaymentInput CardPaymentInput) (Response, error)
- func (cln *Client) CheckOrder(ctx context.Context, orderID string) (Response, error)
- func (cln *Client) CreateOrder(ctx context.Context, order OrderInput) (Response, error)
- func (cln *Client) CreateOrderMinimal(ctx context.Context, order OrderInputMinimal) (Response, error)
- func (cln *Client) DeleteStoredCard(ctx context.Context, cardResourceID string, gatewayBuyerUUID string) (Response, error)
- func (cln *Client) FetchStoredCards(ctx context.Context, buyerUserID string, gatewayBuyerUUID string) (Response, error)
- func (cln *Client) Orders(ctx context.Context, startDate string, endDate string) (Response, error)
- func (cln *Client) UtilityLookup(ctx context.Context, utilityCode, utilityRef, transactionID string) (Response, error)
- func (cln *Client) UtilityPayment(ctx context.Context, body UtilityPaymentInput) (Response, error)
- func (cln *Client) UtilityPaymentStatus(ctx context.Context, trasactionID string) (Response, error)
- func (cln *Client) WalletPayment(ctx context.Context, transactionID string, orderID string, phone string) (Response, error)
- type Error
- type Logger
- type OrderInput
- type OrderInputMinimal
- type Response
- type UtilityPaymentInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithClient ¶
WithClient adds a custom client for processing requests. It's recommend to not use the default client and provide your own.
Types ¶
type CardPaymentInput ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client that can talk to the selcompay API service.
func New ¶
func New(logger Logger, host string, apiKey string, apiSecret string, options ...func(cln *Client)) *Client
New constructs a client that can be used to talk to the selcompay api.
func (*Client) CancelOrder ¶
CancelOrder Cancels an order before customer completes the payment.
func (*Client) CardPayment ¶
func (cln *Client) CardPayment(ctx context.Context, cardPaymentInput CardPaymentInput) (Response, error)
CardPayment allows the ecommerce website to process an order using stored cards directly without redirecting the user to payment gateway page.
func (*Client) CheckOrder ¶
CheckOrder returns status of the order.
func (*Client) CreateOrder ¶
CreateOrder creates a payment order request to the selcom payment gateway. Responds with the payment url, buyer details.
func (*Client) CreateOrderMinimal ¶
func (cln *Client) CreateOrderMinimal(ctx context.Context, order OrderInputMinimal) (Response, error)
CreateOrderMinimal creates a payment order request to the selcom payment gateway. This is for non-card payments. Ideal for mobile wallet push payments and manual payments.
func (*Client) DeleteStoredCard ¶
func (cln *Client) DeleteStoredCard(ctx context.Context, cardResourceID string, gatewayBuyerUUID string) (Response, error)
DeleteStoredCard deletes the provided billing card informations.
func (*Client) FetchStoredCards ¶
func (cln *Client) FetchStoredCards(ctx context.Context, buyerUserID string, gatewayBuyerUUID string) (Response, error)
FetchStoredCards retursn the stored billing cards for the provided buyer. The gatewayBuyerUUID is generated for each user on their first order creation.
func (*Client) Orders ¶
Orders returns a list of orders, satisfying the startDate and endDate params.
func (*Client) UtilityLookup ¶
func (*Client) UtilityPayment ¶
UtilityPayment process payment for a particular payment service.
func (*Client) UtilityPaymentStatus ¶
UtilityPaymentStatus checks ths status of the utility payment.
type Error ¶
type Logger ¶
Logger represents a function that will be called to add information to the user's application logs.
type OrderInput ¶
type OrderInput struct { Vendor string `json:"vendor"` ID string `json:"order_id"` BuyerEmail string `json:"buyer_email"` BuyerName string `json:"buyer_name"` BuyerUserID string `json:"buyer_userid,omitempty"` BuyerPhone string `json:"buyer_phone"` GatewayBuyerUUID string `json:"gateway_buyer_uuid"` Amount int `json:"amount"` Currency string `json:"currency"` PaymentMethods string `json:"payment_methods"` RedirectURL string `json:"redirect_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` Webhook string `json:"webhook,omitempty"` BillingFirstName string `json:"billing.firstname"` BillingLastName string `json:"billing.lastname"` BillingAddress1 string `json:"billing.address_1"` BillingAddress2 string `json:"billing.address_2,omitempty"` BillingCity string `json:"billing.city"` BillingStateRegion string `json:"billing.state_or_region"` BillingPostCodePOBox string `json:"billing.postcode_or_pobox"` BillingCountry string `json:"billing.country"` BillingPhone string `json:"billing.phone"` ShippingFirstName string `json:"shipping.firstname,omitempty"` ShippingLastName string `json:"shipping.lastname,omitempty"` ShippingAddress1 string `json:"shipping.address_1,omitempty"` ShippingAddress2 string `json:"shipping.address_2,omitempty"` ShippingCity string `json:"shipping.city,omitempty"` ShippingStateRegion string `json:"shipping.state_or_region,omitempty"` ShippingPostCodePOBox string `json:"shipping.postcode_or_pobox,omitempty"` ShippingCountry string `json:"shipping.country,omitempty"` ShippingPhone string `json:"shipping.phone,omitempty"` BuyerRemarks string `json:"buyer_remarks,omitempty"` MerchantRemarks string `json:"merchant_remarks,omitempty"` NumberItems int `json:"no_of_items,omitempty"` HeaderColour string `json:"header_colour,omitempty"` LinkColour string `json:"link_colour,omitempty"` ButtonColour string `json:"button_colour,omitempty"` Expiry int `json:"expiry,omitempty"` }
OrderInput represents the input for the checkout order call.
type OrderInputMinimal ¶
type OrderInputMinimal struct { Vendor string `json:"vendor"` ID string `json:"order_id"` BuyerEmail string `json:"buyer_email"` BuyerName string `json:"buyer_name"` BuyerPhone string `json:"buyer_phone"` Amount int `json:"amount"` Currency string `json:"currency"` RedirectURL string `json:"redirect_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` Webhook string `json:"webhook,omitempty"` BuyerRemarks string `json:"buyer_remarks,omitempty"` MerchantRemarks string `json:"merchant_remarks,omitempty"` NumberItems int `json:"no_of_items,omitempty"` HeaderColour string `json:"header_colour,omitempty"` LinkColour string `json:"link_colour,omitempty"` ButtonColour string `json:"button_colour,omitempty"` Expiry int `json:"expiry,omitempty"` }