Passed
Push — main ( 0c2c25...2b69c2 )
by Acho
02:33
created

stubs.RefundStatusWithMaxRetryExceeded   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
// RefundInvalidClientResponse is the response when refunding with an invalid client
4
func RefundInvalidClientResponse() []byte {
5
	return []byte(`{"error":"invalid_client"}`)
6
}
7
8
// RefundResponse is the response when refunding a transaction
9
func RefundResponse() []byte {
10
	return []byte(`
11
{
12
    "MD5OfMessageBody": "4b55cf6629b5f0ee3c8ac91435a2eb35",
13
    "MD5OfMessageAttributes": "896f665ac83c778c88943113ee0ccd55",
14
    "MessageId": "993764f9-6b1f-41bd-a7ca-97b8b2167ed7",
15
    "ResponseMetadata": {
16
        "RequestId": "e7b09b6d-0d11-5111-8dc9-c4ab56e3cf7c",
17
        "HTTPStatusCode": 200,
18
        "HTTPHeaders": {
19
            "x-amzn-requestid": "e7b09b6d-0d11-5111-8dc9-c4ab56e3cf7c",
20
            "date": "Sun, 01 Dec 2024 12:42:26 GMT",
21
            "content-type": "application/x-amz-json-1.0",
22
            "content-length": "166",
23
            "connection": "keep-alive"
24
        },
25
        "RetryAttempts": 0
26
    }
27
}
28
`)
29
}
30
31
// RefundStatusResponse is the response when checking the status of a refund transaction
32
func RefundStatusResponse() []byte {
33
	return []byte(`
34
{
35
    "result": {
36
        "message": "Cash in performed successfully",
37
        "data": {
38
            "createtime": "1733056973",
39
            "subscriberMsisdn": "695xxxxxx",
40
            "amount": 98,
41
            "payToken": "CI24120168FBF65A909F588B4480",
42
            "txnid": "CI241201.1342.C36820",
43
            "txnmode": "rembourse",
44
            "txnstatus": "200",
45
            "orderId": "rembourse",
46
            "status": "SUCCESSFULL",
47
            "channelUserMsisdn": "695xxxxxx",
48
            "description": "Remboursement"
49
        }
50
    },
51
    "parameters": {
52
        "amount": "98",
53
        "xauth": "WU5PVEVIRUFExxxxxxxxxxx",
54
        "channel_user_msisdn": "69xxxxxx",
55
        "customer_key": "2fBAAq_xxxxxxx",
56
        "customer_secret": "34nFkKxxxxxx",
57
        "final_customer_name": "Arnold",
58
        "final_customer_phone": "69xxxxxx",
59
        "final_customer_name_accuracy": "0"
60
    },
61
    "CreateAt": "12-01-2024 12:43:00",
62
    "MessageId": "993764f9-6b1f-41bd-a7ca-97b8b2167ed7",
63
    "RefundStep": "2"
64
}
65
`)
66
}
67
68
// RefundStatusResponseWithFailure represents a refund status response with a failure
69
func RefundStatusResponseWithFailure() []byte {
70
	return []byte(`
71
{
72
   "ErrorCode":5019,
73
   "body":"Exception on getToken",
74
   "ErrorMessage":"[Errno 97] Address family not supported by protocol",
75
   "status":"FAILED",
76
   "parameters":{
77
      "amount":"10182",
78
      "xauth":"WU5PVEVIRUFEOxxxxxxxxxxxxxx",
79
      "channel_user_msisdn":"693xxxxxx",
80
      "customer_key":"2fBAAq_xxxxxxxxxxxxxxxxxxxx",
81
      "customer_secret":"34nFxxxxxxxxxxxxxxxxxxxxx",
82
      "final_customer_name":"Arnold",
83
      "final_customer_phone":"693xxxxxx"
84
   },
85
   "CreateAt":"12-20-2024 12:14:38",
86
   "MessageId":"90be9142-4216-4113-bdc4-d1d11ede2460",
87
   "RefundStep":"1"
88
}
89
`)
90
}
91
92
// RefundStatusWithMaxRetryExceeded represents a refund status response with a max retry exceeded
93
func RefundStatusWithMaxRetryExceeded() []byte {
94
	return []byte(`
95
{
96
    "CreateAt": "01-29-2025 20:20:08",
97
    "RefundStep": "1",
98
    "result": {
99
        "data": {
100
            "amount": "",
101
            "channelUserMsisdn": "",
102
            "createtime": "",
103
            "description": "Max retry exceeded",
104
            "orderId": "",
105
            "payToken": "",
106
            "status": "FAILED",
107
            "subscriberMsisdn": "",
108
            "txnid": "",
109
            "txnmessage": "Max retry exceeded",
110
            "txnmode": "",
111
            "txnstatus": ""
112
        },
113
        "message": "Transaction retrieved successfully"
114
    }
115
}
116
`)
117
}
118