-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudpayments.go
50 lines (40 loc) · 1.34 KB
/
cloudpayments.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
package cloudpayments
const (
HeaderXContentHMAC = "X-Content-HMAC"
HeaderContentHMAC = "Content-HMAC"
baseURL = "api.cloudpayments.ru"
paymentsGroup = "payments"
cardsGroup = "cards"
singlePayMethod = "charge"
post3dsMethod = "post3ds"
subscriptionsGroup = "subscriptions"
createSubscriptionMethod = "create"
getSubscriptionMethod = "get"
findSubscriptionMethod = "find"
updateSubscriptionMethod = "update"
cancelSubscriptionMethod = "cancel"
)
type CloudPayments interface {
SetSecret(secret string)
SetPublicID(pubID string)
Post3ds(params Post3dsRequest) (*PaymentResponse, error)
PayByCryptogram(params CryptoPayRequest) (*PaymentResponse, error)
Subscribe(params CreateSubscribeRequest) (*PaymentResponse, error)
UpdateSubscribe(params UpdateSubscribeRequest) (*PaymentResponse, error)
GetSubscription(params SubscribeRequest) (*PaymentResponse, error)
FindSubscriptions(params FindSubscriptionsRequest) (*FindSubscriptionsResponse, error)
Unsubscribe(params SubscribeRequest) (*PaymentResponse, error)
}
type cloudPayments struct {
apiSecret string
publicID string
}
func New(secret, publicID string) CloudPayments {
return &cloudPayments{secret, publicID}
}
func (cp *cloudPayments) SetSecret(secret string) {
cp.apiSecret = secret
}
func (cp *cloudPayments) SetPublicID(pubID string) {
cp.publicID = pubID
}