forked from ahmkindi/go-thawani
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.go
67 lines (56 loc) · 1.77 KB
/
data.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
package thawani
import (
"net/http"
"net/url"
"github.com/ahmkindi/go-thawani/types/mode"
"github.com/ahmkindi/go-thawani/types/paymentstatus"
)
type ThawaniClient struct {
HTTPClient *http.Client
BaseURL *url.URL
APIKey string
PublishableKey string
}
type Product struct {
Name string `json:"name"`
Quantity int `json:"quantity"`
UnitAmount int `json:"unit_amount"`
}
type CreateSessionReq struct {
ClientReferenceId string `json:"client_reference_id"`
Mode mode.Type `json:"mode"`
Products []Product `json:"products"`
SuccessUrl string `json:"success_url"`
CancelUrl string `json:"cancel_url"`
CustomerId string `json:"customer_id"`
Metadata map[string]string `json:"metadata"`
}
type CustomerData struct {
Id string `json:"id"`
CustomerClientId string `json:"customer_client_id"`
}
type SessionData struct {
SessionId string `json:"session_id"`
ClientReferenceId string `json:"client_reference_id"`
CustomerId string `json:"customer_id"`
Products []Product `json:"products"`
TotalAmount int `json:"total_amount"`
PaymentStatus paymentstatus.Type `json:"payment_status"`
}
type BasicResponse struct {
Success bool `json:"success"`
Code int `json:"code"`
Description string `json:"description"`
}
type CreateCustomerReq struct {
ClientCustomerId string `json:"client_customer_id"`
}
type CreateCustomerResp struct {
BasicResponse
Data CustomerData `json:"data"`
}
type Session struct {
BasicResponse
Data SessionData `json:"data"`
Metadata map[string]interface{} `json:"metadata"`
}