-
Notifications
You must be signed in to change notification settings - Fork 25
/
mockup.go
56 lines (45 loc) · 1.27 KB
/
mockup.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
package example
import (
"github.com/midtrans/midtrans-go"
"github.com/midtrans/midtrans-go/coreapi"
"github.com/midtrans/midtrans-go/snap"
"strconv"
"time"
)
const SandboxServerKey1 = "SB-Mid-server-TvgWB_Y9s81-rbMBH7zZ8BHW"
const SandboxServerKey2 = "SB-Mid-server-TOq1a2AVuiyhhOjvfs3U_KeO"
const SandboxClientKey2 = "SB-Mid-client-nKsqvar5cn60u2Lv"
const IrisCreatorKeySandbox = "IRIS-330198f0-e49d-493f-baae-585cfded355d"
const IrisApproverKeySandbox = "IRIS-1595c12b-6814-4e5a-bbbb-9bc18193f47b"
func SnapParamWithMap() *snap.RequestParamWithMap {
req := &snap.RequestParamWithMap{
"transaction_details": map[string]interface{}{
"order_id": "MID-GO-TEST-" + Random(),
"gross_amount": 10000,
},
}
return req
}
func SnapParam() *snap.Request {
req := & snap.Request{
TransactionDetails: midtrans.TransactionDetails{
OrderID: "MID-GO-TEST-" + Random(),
GrossAmt: 100000,
},
}
return req
}
func CoreParam() *coreapi.ChargeReqWithMap {
req := &coreapi.ChargeReqWithMap{
"payment_type": "gopay",
"transaction_details": map[string]interface{}{
"order_id": "MID-GO-TEST-" + Random(),
"gross_amount": 10000,
},
}
return req
}
func Random() string {
time.Sleep(500 * time.Millisecond)
return strconv.FormatInt(time.Now().Unix(), 10)
}