-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathrequest.go
More file actions
175 lines (148 loc) · 5.56 KB
/
Copy pathrequest.go
File metadata and controls
175 lines (148 loc) · 5.56 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package midtrans
// Represent the transaction details
type ItemDetail struct {
Id string `json:"id"`
Name string `json:"name"`
Price float64 `json:"price"`
Qty int32 `json:"quantity"`
}
type CustAddress struct {
FName string `json:"first_name"`
LName string `json:"last_name"`
Phone string `json:"phone"`
Address string `json:"address"`
City string `json:"city"`
Postcode string `json:"postal_code"`
CountryCode string `json:"country_code"`
}
// Represent the customer detail
type CustDetail struct {
// first name
FName string `json:"first_name"`
// last name
LName string `json:"last_name"`
Email string `json:"email"`
Phone string `json:"phone"`
BillAddr *CustAddress `json:"billing_address,omitempty"`
ShipAddr *CustAddress `json:"customer_address,omitempty"`
}
type TransactionDetails struct {
OrderID string `json:"order_id"`
GrossAmt float64 `json:"gross_amount"`
}
type CreditCardDetail struct {
TokenID string `json:"token_id"`
Bank string `json:"bank,omitempty"`
Bins []string `json:"bins,omitempty"`
InstallmentTerm []int8 `json:"installment_term,omitempty"`
Type string `json:"type,omitempty"`
// indicate if generated token should be saved for next charge
SaveTokenID bool `json:"save_token_id,omitempty"`
SavedTokenIdExpireAt string `json:"saved_token_id_expired_at,omitempty"`
}
type PermataBankTransferDetail struct {
Bank Bank `json:"bank"`
}
type BCABankTransferLangDetail struct {
LangID string `json:"id,omitempty"`
LangEN string `json:"en,omitempty"`
}
/*
Example of usage syntax:
midtrans.BCABankTransferDetail{
FreeText: {
Inquiry: []midtrans.BCABankTransferLangDetail{
{
LangEN: "Test",
LangID: "Coba",
},
},
},
}
*/
type BCABankTransferDetailFreeText struct {
Inquiry []BCABankTransferLangDetail `json:"inquiry"`
Payment []BCABankTransferLangDetail `json:"payment"`
}
type BCABankTransferDetail struct {
Bank Bank `json:"bank"`
VaNumber string `json:"va_number"`
FreeText BCABankTransferDetailFreeText `json:"free_text"`
}
type MandiriBillBankTransferDetail struct {
BillInfo1 string `json:"bill_info1,omitempty"`
BillInfo2 string `json:"bill_info2,omitempty"`
}
type BankTransferDetail struct {
Bank Bank `json:"bank,omitempty"`
VaNumber string `json:"va_number,omitempty"`
FreeText BCABankTransferDetailFreeText `json:"free_text,omitempty"`
*MandiriBillBankTransferDetail
}
// Internet Banking for BCA KlikPay
type BCAKlikPayDetail struct {
// 1 = normal, 2 = installment, 3 = normal + installment
Type string `json:"type"`
Desc string `json:"description"`
MiscFee int64 `json:"misc_fee,omitempty"`
}
type BCAKlikBCADetail struct {
Desc string `json:"description"`
UserID string `json:"user_id"`
}
type MandiriClickPayDetail struct {
CardNumber string `json:"card_number"`
Input1 string `json:"input1"`
Input2 string `json:"input2"`
Input3 string `json:"input3"`
Token string `json:"token"`
}
type CIMBClicksDetail struct {
Desc string `json:"description"`
}
type TelkomselCashDetail struct {
Promo bool `json:"promo"`
IsReversal int8 `json:"is_reversal"`
Customer string `json:"customer"`
}
type IndosatDompetkuDetail struct {
MSISDN string `json:"msisdn"`
}
type MandiriEcashDetail struct {
Desc string `json:"description"`
}
type ConvStoreDetail struct {
Store string `json:"store"`
Message string `json:"message"`
}
// Represent the request payload
type ChargeReq struct {
PaymentType PaymentType `json:"payment_type"`
TransactionDetails TransactionDetails `json:"transaction_details"`
CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
BankTransfer *BankTransferDetail `json:"bank_transfer,omitempty"`
MandiriBillBankTransferDetail *MandiriBillBankTransferDetail `json:"echannel,omitempty"`
BCAKlikPay *BCAKlikPayDetail `json:"bca_klikpay,omitempty"`
BCAKlikBCA *BCAKlikBCADetail `json:"bca_klikbca,omitempty"`
MandiriClickPay *MandiriClickPayDetail `json:"mandiri_clickpay,omitempty"`
MandiriEcash *MandiriEcashDetail `json:"mandiri_ecash,omitempty"`
CIMBClicks *CIMBClicksDetail `json:"cimb_clicks,omitempty"`
TelkomselCash *TelkomselCashDetail `json:"telkomsel_cash,omitempty"`
IndosatDompetku *IndosatDompetkuDetail `json:"indosat_dompetku,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
ConvStore *ConvStoreDetail `json:"cstore,omitempty"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustField1 string `json:"custom_field1,omitempty"`
CustField2 string `json:"custom_field2,omitempty"`
CustField3 string `json:"custom_field3,omitempty"`
}
type SnapReq struct {
TransactionDetails TransactionDetails `json:"transaction_details"`
EnabledPayments []PaymentType `json:"enabled_payments"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
}
type CaptureReq struct {
TransactionID string `json:"transaction_id"`
GrossAmt float64 `json:"gross_amount"`
}