Documentation ¶
Overview ¶
Package paypal is a PayPal implementation of payment method interface declared in "github.com/ottemo/commerce/app/models/checkout" package
Index ¶
- Constants
- func APIDecline(context api.InterfaceApplicationContext) (interface{}, error)
- func APIReceipt(context api.InterfaceApplicationContext) (interface{}, error)
- func CompleteTransaction(orderInstance order.InterfaceOrder, token string, payerID string) (map[string]string, error)
- type Express
- func (it *Express) Authorize(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *Express) Capture(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *Express) DeleteSavedCard(token visitor.InterfaceVisitorCard) (interface{}, error)
- func (it *Express) GetCode() string
- func (it Express) GetInternalName() string
- func (it *Express) GetName() string
- func (it *Express) GetType() string
- func (it *Express) IsAllowed(checkoutInstance checkout.InterfaceCheckout) bool
- func (it *Express) IsTokenable(checkoutInstance checkout.InterfaceCheckout) bool
- func (it *Express) Refund(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *Express) Void(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- type PayFlowAPI
- func (it *PayFlowAPI) Authorize(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *PayFlowAPI) AuthorizeZeroAmount(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *PayFlowAPI) Capture(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *PayFlowAPI) DeleteSavedCard(token visitor.InterfaceVisitorCard) (interface{}, error)
- func (it *PayFlowAPI) GetAccessToken(originRequestParams string) (string, error)
- func (it *PayFlowAPI) GetCode() string
- func (it PayFlowAPI) GetInternalName() string
- func (it *PayFlowAPI) GetName() string
- func (it *PayFlowAPI) GetType() string
- func (it *PayFlowAPI) IsAllowed(checkoutInstance checkout.InterfaceCheckout) bool
- func (it *PayFlowAPI) IsTokenable(checkoutInstance checkout.InterfaceCheckout) bool
- func (it *PayFlowAPI) Refund(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- func (it *PayFlowAPI) Void(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
- type RestAPI
Constants ¶
const ( ConstLogStorage = "paypal.log" ConstErrorModule = "payment/paypal" ConstErrorLevel = env.ConstErrorLevelActor ConstPaymentActionSale = "Sale" ConstPaymentActionAuthorization = "Authorization" ConstPaymentCode = "paypal_express" ConstPaymentName = "PayPal Express" ConstConfigPathGroup = "payment.paypalExpress" ConstConfigPathEnabled = "payment.paypalExpress.enabled" ConstConfigPathTitle = "payment.paypalExpress.title" ConstConfigPathUser = "payment.paypalExpress.user" ConstConfigPathPass = "payment.paypalExpress.password" ConstConfigPathSignature = "payment.paypalExpress.signature" ConstConfigPathAction = "payment.paypalExpress.action" ConstConfigPathPayPalExpressGateway = "payment.paypalExpress.gateway" ConstConfigPathPayPalPayFlowGateway = "payment.paypalPayflowPro.gateway" ConstPaymentPayPalGatewaySandbox = "sandbox" ConstPaymentPayPalGatewayProduction = "production" ConstPaymentPayPalGateway = "gateway" ConstPaymentPayPalHost = "host" ConstPaymentPayPalNvp = "nvp" ConstPaymentPayPalUrl = "url" ConstPaymentPayPalPayflowCode = "paypal_payflow" ConstPaymentPayPalPayflowName = "PayPal Payflow" ConstConfigPathPayPalPayflowGroup = "payment.paypalPayflowPro" ConstConfigPathPayPalPayflowEnabled = "payment.paypalPayflowPro.enabled" ConstConfigPathPayPalPayflowTokenable = "payment.paypalPayflowPro.tokanable" ConstConfigPathPayPalPayflowTitle = "payment.paypalPayflowPro.title" ConstConfigPathPayPalPayflowUser = "payment.paypalPayflowPro.user" ConstConfigPathPayPalPayflowPass = "payment.paypalPayflowPro.password" ConstConfigPathPayPalPayflowVendor = "payment.paypalPayflowPro.vendor" )
Package global constants
Variables ¶
This section is empty.
Functions ¶
func APIDecline ¶
func APIDecline(context api.InterfaceApplicationContext) (interface{}, error)
APIDecline processes PayPal decline response
- refer to https://developer.paypal.com/docs/classic/api/NVPAPIOverview/ for details
func APIReceipt ¶
func APIReceipt(context api.InterfaceApplicationContext) (interface{}, error)
APIReceipt processes PayPal receipt response
- "token" field should contain valid session ID
- refer to https://developer.paypal.com/docs/classic/api/NVPAPIOverview/ for details
func CompleteTransaction ¶
func CompleteTransaction(orderInstance order.InterfaceOrder, token string, payerID string) (map[string]string, error)
CompleteTransaction makes NVP request to PayPal for a given purchase order using PayPal token and payer id
- refer to https://developer.paypal.com/docs/classic/api/NVPAPIOverview/ for details
Types ¶
type Express ¶
type Express struct{}
Express is a implementer of InterfacePaymentMethod for a PayPal Express method
func (*Express) Authorize ¶
func (it *Express) Authorize(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Authorize makes payment method authorize operation
func (*Express) Capture ¶
func (it *Express) Capture(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Capture payment method capture operation
func (*Express) DeleteSavedCard ¶
func (it *Express) DeleteSavedCard(token visitor.InterfaceVisitorCard) (interface{}, error)
Delete saved card from the payment system. **This method is for future use**
func (Express) GetInternalName ¶
GetInternalName returns the name of the payment method
func (*Express) IsAllowed ¶
func (it *Express) IsAllowed(checkoutInstance checkout.InterfaceCheckout) bool
IsAllowed checks for method applicability
func (*Express) IsTokenable ¶
func (it *Express) IsTokenable(checkoutInstance checkout.InterfaceCheckout) bool
IsTokenable checks for method applicability
type PayFlowAPI ¶
type PayFlowAPI struct{}
PayFlowAPI is a implementer of PayPal Pro payflow API methods
func (*PayFlowAPI) Authorize ¶
func (it *PayFlowAPI) Authorize(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Authorize makes payment method authorize operation (currently it's a Authorize zero amount + Sale operations)
func (*PayFlowAPI) AuthorizeZeroAmount ¶
func (it *PayFlowAPI) AuthorizeZeroAmount(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
AuthorizeZeroAmount will do Account Verification and return transaction ID for refer transaction if all info is valid
func (*PayFlowAPI) Capture ¶
func (it *PayFlowAPI) Capture(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Capture payment method capture operation
func (*PayFlowAPI) DeleteSavedCard ¶
func (it *PayFlowAPI) DeleteSavedCard(token visitor.InterfaceVisitorCard) (interface{}, error)
Delete saved card from the payment system. **This method is for future use**
func (*PayFlowAPI) GetAccessToken ¶
func (it *PayFlowAPI) GetAccessToken(originRequestParams string) (string, error)
GetAccessToken returns application access token
func (*PayFlowAPI) GetCode ¶
func (it *PayFlowAPI) GetCode() string
GetCode returns PayPal code value for this payment method
func (PayFlowAPI) GetInternalName ¶
func (it PayFlowAPI) GetInternalName() string
GetInternalName returns the name of the payment method
func (*PayFlowAPI) GetName ¶
func (it *PayFlowAPI) GetName() string
GetName returns the user customized name of the payment method
func (*PayFlowAPI) GetType ¶
func (it *PayFlowAPI) GetType() string
GetType returns the type of payment method
func (*PayFlowAPI) IsAllowed ¶
func (it *PayFlowAPI) IsAllowed(checkoutInstance checkout.InterfaceCheckout) bool
IsAllowed checks for method applicability
func (*PayFlowAPI) IsTokenable ¶
func (it *PayFlowAPI) IsTokenable(checkoutInstance checkout.InterfaceCheckout) bool
IsTokenable checks for method applicability
func (*PayFlowAPI) Refund ¶
func (it *PayFlowAPI) Refund(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Refund makes payment method refund operation
func (*PayFlowAPI) Void ¶
func (it *PayFlowAPI) Void(orderInstance order.InterfaceOrder, paymentInfo map[string]interface{}) (interface{}, error)
Void makes payment method void operation