-
Notifications
You must be signed in to change notification settings - Fork 4
/
decl.go
99 lines (75 loc) · 3.35 KB
/
decl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Package paypal is a PayPal implementation of payment method interface declared in
// "github.com/ottemo/commerce/app/models/checkout" package
package paypal
import (
"sync"
"github.com/ottemo/commerce/env"
)
// Package global constants
const (
// PayPal general constants
ConstLogStorage = "paypal.log"
ConstErrorModule = "payment/paypal"
ConstErrorLevel = env.ConstErrorLevelActor
ConstPaymentActionSale = "Sale"
ConstPaymentActionAuthorization = "Authorization"
// PayPal express constants
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"
// PayPal PayFlow Pro API constants
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 variables
var (
waitingTokens = make(map[string]interface{})
waitingTokensMutex sync.RWMutex
paymentPayPalExpress = map[string]map[string]string{
ConstPaymentPayPalNvp: {
ConstPaymentPayPalGatewaySandbox: "https://api-3t.sandbox.paypal.com/nvp",
ConstPaymentPayPalGatewayProduction: "https://api-3t.paypal.com/nvp",
},
ConstPaymentPayPalGateway: {
ConstPaymentPayPalGatewaySandbox: "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout",
ConstPaymentPayPalGatewayProduction: "https://www.paypal.com/webscr?cmd=_express-checkout",
},
}
paymentPayPalPayFlow = map[string]map[string]string{
ConstPaymentPayPalUrl: {
ConstPaymentPayPalGatewaySandbox: "https://pilot-payflowpro.paypal.com",
ConstPaymentPayPalGatewayProduction: "https://payflowpro.paypal.com",
},
ConstPaymentPayPalHost: {
ConstPaymentPayPalGatewaySandbox: "https://pilot-payflowpro.paypal.com",
ConstPaymentPayPalGatewayProduction: "https://payflowpro.paypal.com",
},
}
)
// Express is a implementer of InterfacePaymentMethod for a PayPal Express method
type Express struct{}
// RestAPI is a implementer of InterfacePaymentMethod for a PayPal REST API method (currently not working)
type RestAPI struct{}
// PayFlowAPI is a implementer of PayPal Pro payflow API methods
type PayFlowAPI struct{}