-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCreatePayment.go
42 lines (39 loc) · 1.06 KB
/
CreatePayment.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
package Iyzipay
import (
"encoding/json"
"fmt"
"github.com/icobani/iyzipay-go/Request"
"github.com/icobani/iyzipay-go/Response"
)
func (i Iyzipay) CreatePayment(obj *Request.CreatePaymentRequest) (Response.CreatePaymentResponse, error) {
result := Response.CreatePaymentResponse{}
if resp, err := i.Client.R().
SetHeaders(i.GetHeaders(*obj)).
SetBody(obj).
Post(i.GetURI("/payment/3dsecure/initialize")); err == nil {
//fmt.Println(string(resp.Body()))
err = json.Unmarshal(resp.Body(), &result)
if err != nil {
return result, err
}
return result, nil
} else {
return result, err
}
}
func (i Iyzipay) ThreeDSPayment(obj *Request.ThreeDHandshakeReq) (Response.HandshakeResponse3D, error) {
result := Response.HandshakeResponse3D{}
if resp, err := i.Client.R().
SetHeaders(i.GetHeaders(*obj)).
SetBody(obj).
Post(i.GetURI("/payment/3dsecure/auth")); err == nil {
fmt.Println(string(resp.Body()))
err = json.Unmarshal(resp.Body(), &result)
if err != nil {
return result, err
}
return result, nil
} else {
return result, err
}
}