-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayments.go
40 lines (31 loc) · 954 Bytes
/
payments.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
package cloudpayments
import (
"encoding/json"
"fmt"
)
func (cp *cloudPayments) PayByCryptogram(params CryptoPayRequest) (*PaymentResponse, error) {
requestURL := cp.GenerateRequestURI(baseURL, paymentsGroup, cardsGroup, singlePayMethod)
bt, err := json.Marshal(params)
if err != nil {
err = fmt.Errorf("json.Marshal: %w", err)
return nil, err
}
resp, err := cp.GetPaymentResponse(requestURL, bt)
if err != nil {
return nil, fmt.Errorf("cp.GetPaymentResponse: %w", err)
}
return resp, nil
}
func (cp *cloudPayments) Post3ds(params Post3dsRequest) (*PaymentResponse, error) {
requestURL := cp.GenerateRequestURI(baseURL, paymentsGroup, cardsGroup, post3dsMethod)
bt, err := json.Marshal(params)
if err != nil {
err = fmt.Errorf("json.Marshal: %w", err)
return nil, err
}
resp, err := cp.GetPaymentResponse(requestURL, bt)
if err != nil {
return nil, fmt.Errorf("cp.GetPaymentResponse: %w", err)
}
return resp, nil
}