Passed
Push — main ( 853831...e0857a )
by Acho
02:36
created

stubs.PostWithdrawResponse   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package stubs
2
3
// PostTokenResponse is a dummy JSOn response for getting access token
4
func PostTokenResponse() []byte {
5
	return []byte(`
6
	{
7
		"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsInVpZCI6Mn0.eyJpYXQiOjE2MDM4MjQyODMsIm5iZiI6MTYwMzgyNDI4MywiZXhwIjoxNjAzODI3ODgzfQ.ufW8sCrf_W2RFpVvH6zri0l7pJLnkPXCZi1zc10ZvOg",
8
		"expires_in": 3600
9
	}
10
`)
11
}
12
13
// PostCollectResponse is a dummy JSON response for requesting a payment
14
func PostCollectResponse() string {
15
	return `
16
	{
17
		  "reference": "bcedde9b-62a7-4421-96ac-2e6179552a1a",
18
		  "ussd_code": "*126# for MTN or #150*50# for ORANGE",
19
		  "operator": "mtn or orange"
20
	}`
21
}
22
23
// GetTransactionResponse is a dummy JSON response for the Transaction Status
24
func GetTransactionResponse() []byte {
25
	return []byte(`
26
	{
27
		"reference": "bcedde9b-62a7-4421-96ac-2e6179552a1a",
28
		"status": "PENDING",
29
		"amount": 1,
30
		"currency": "XAF",
31
		"operator": "MTN",
32
		"code": "CP201027T00005",
33
		"operator_reference": "1880106956"
34
	}`)
35
}
36
37
// GetBalanceResponse is a dummy JSON response for the transaction balance
38
func GetBalanceResponse() string {
39
	return `
40
	{
41
		"total_balance": 0,
42
		"mtn_balance": 0,
43
		"orange_balance": 0,
44
		"currency": "XAF"
45
	}
46
`
47
}
48
49
// PostWithdrawResponse is a dummy JSON response for withdraw requests
50
func PostWithdrawResponse() []byte {
51
	return []byte(`
52
	{
53
		"reference":"26676007-1c31-46d7-9c71-acb031cf0de4",
54
		"status":"PENDING"
55
	}
56
`)
57
}
58
59
// GetHistoryResponse is a dummy JSON response for the transaction history
60
func GetHistoryResponse() string {
61
	return `
62
	{
63
		"data": [
64
			{
65
				"datetime": "2021-01-29T09:52:34.876707Z",
66
				"code": "CP210129D0001P",
67
				"operator_tx_code": "MP210129.1052.A35072",
68
				"operator": "Orange",
69
				"phone_number": "237696546822",
70
				"description": "Test",
71
				"external_user": "",
72
				"amount": 5,
73
				"charge_amount": 0.05,
74
				"debit": 0,
75
				"credit": 4.95,
76
				"status": "SUCCESSFUL",
77
				"reference_uuid": "25c63c72-8485-4059-85ad-fdb4bfb26c21"
78
			},
79
			{
80
				"datetime": "2021-01-25T12:44:11.808507Z",
81
				"code": "CP210125D0001N",
82
				"operator_tx_code": "2171591856",
83
				"operator": "MTN",
84
				"phone_number": "237679587525",
85
				"description": "Test",
86
				"external_user": "",
87
				"amount": 5,
88
				"charge_amount": 0.05,
89
				"debit": 0,
90
				"credit": 4.95,
91
				"status": "FAILED",
92
				"reference_uuid": "769dc5c3-1a98-4788-bac4-2daaa49a58b6"
93
			}
94
		]
95
	}
96
`
97
}
98