-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathreports-deprecated.js
137 lines (130 loc) · 5.83 KB
/
reports-deprecated.js
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
var nock = require('nock');
nock('https://devapi.currencycloud.com:443')
.post('/v2/authenticate/api', {
"login_id": "[email protected]",
"api_key": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
})
.reply(200, {"auth_token": "efa3f4d86206ef45263d7ce1dafeadbb"});
//Create conversion report
nock('https://devapi.currencycloud.com:443')
.post('/v2/reports/conversions/create', {
"buy_currency": "EUR",
"sell_currency": "GBP"
})
.reply(200, {
"id": "c2d7dd2c-9317-4517-9f5d-8d287a1c4ee7",
"short_reference": "RP-4270806-VLOIID",
"search_params": {
"buy_currency": "EUR",
"sell_currency": "GBP",
"scope": "own"
},
"report_type": "conversion",
"status": "processing",
"report_url": "",
"account_id": "c0ea266f-b969-4d61-9ca0-e790c79072e5",
"contact_id": "3cae081f-56f7-4f2d-8235-45713b592b43",
"created_at": "2018-11-05T15:12:45+00:00",
"updated_at": "2018-11-05T15:12:45+00:00"
});
// Create payment report
nock('https://devapi.currencycloud.com:443')
.post('/v2/reports/payments/create', {
description: 'TESTING REPORT FOR PAYMENTS',
currency: 'GBP',
amount_from: '1000',
amount_to: '10000'
})
.reply(200, {
"id": "41fc3cd8-5d7f-4c20-8b0c-58eb6d653695",
"short_reference": "RP-6523110-DNTMME",
"search_params": {
"currency": "GBP",
"scope": "own"
},
"report_type": "payment",
"status": "processing",
"report_url": "",
"account_id": "c0ea266f-b969-4d61-9ca0-e790c79072e5",
"contact_id": "3cae081f-56f7-4f2d-8235-45713b592b43",
"created_at": "2018-10-22T08:27:03+00:00",
"updated_at": "2018-10-22T08:27:03+00:00"
});
// Find report requests
nock('https://devapi.currencycloud.com:443')
.get('/v2/reports/report_requests/find')
.query({"per_page": "1"})
.reply(200, {
"report_requests": [{
"id": "195557f7-7f2a-47ff-92d7-b8662dd100fd",
"short_reference": "RP-7918625-XWJQIG",
"search_params": {
"buy_currency": "EUR",
"sell_currency": "GBP",
"unique_request_id": "a2730264-5bc1-2313-fea6-461243f3ea5a",
"scope": "own"
},
"report_type": "conversion",
"status": "completed",
"expiration_date": "2018-10-18T00:00:00+00:00",
"report_url": "https://ccycloud-reports-prod-demo1-customer-reporting.s3.eu-west-1.amazonaws.com/customer_reporting/195557f7-7f2a-47ff-92d7-b8662dd100fd/conversion_report_1610201808101539677687.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAWPXXYKBYH32WNW34%2F20181109%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20181109T135934Z&X-Amz-Expires=172800&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FQoGZXIvYXdzEH8aDI%2FywdCSuDjEp6HmrCK3A91l4c4TwrpR6Pg5r3hFzVzfmAF528%2BIKxP8RcS%2Fz3jpPwDKzV4LTw1rsKMTq9Ln7ODvG33jtqtey4C1RzByT%2BbAE2h%2BcvBgTK7Enx204Va6yQ3gh2KLb4cCRR8Hs4rl4vyCGh2gopM6%2FA%2BZufcoPG%2BX0l3iH5WfTtHLZt2xZyXGj%2Frkge45XLMID%2Bk%2Fjr7Sc%2BCcncuVluaXMDb2rYz7A9mNnFjbMEfLyuOvItZnxZrWZSduth00x%2FrM0ffKJN9tVuQjSwZE5JuQaAJYp3xsxykymbSMCzdyNxGQiz3jVrEKNl8SH6jD4Z3pE%2FtKWYrEAxPj6XgUGI8btG6HPQ94qPL3JjupNdjrbSpCX0bynG0fhS%2FMjRm74iwneYNUYlQ7qHYKdal5Wut39nnxTJTKm4wE5nhfXypKPBtDhEwkhVuGIzvTwKniCy5AY25ahSR4i7XBFFF1ymi0Uowvbgh1ti5lgBRdrmMgjXZRfrI67sMp%2FZZW%2BSgDPdNm4hVPMcY11DyAs9sXcSW%2BS55%2Fe6rrs1AMj%2F7VS1roWXor31h5FtEqbp%2Fy3fQ3ojhSWj1SKD4LVoIfDUfi2gQorZmW3wU%3D&X-Amz-Signature=2357745295f6f51cac8e55b10ab52c419a6853463240438267dea88df5d70a9a",
"account_id": "c0ea266f-b969-4d61-9ca0-e790c79072e5",
"contact_id": "3cae081f-56f7-4f2d-8235-45713b592b43",
"created_at": "2018-10-16T08:14:46+00:00",
"updated_at": "2018-10-16T08:14:48+00:00"
}],
"pagination": {
"total_entries": 100,
"total_pages": 100,
"current_page": 1,
"per_page": 1,
"previous_page": -1,
"next_page": 2,
"order": "created_at ASC",
"order_asc_desc": "asc"
}
});
// Retrieve report request via id
nock('https://devapi.currencycloud.com:443')
.post('/v2/reports/conversions/create', {
"buy_currency": "EUR",
"sell_currency": "GBP"
})
.reply(200, {
"id": "c2d7dd2c-9317-4517-9f5d-8d287a1c4ee7",
"short_reference": "RP-4270806-VLOIID",
"search_params": {
"buy_currency": "EUR",
"sell_currency": "GBP",
"scope": "own"
},
"report_type": "conversion",
"status": "processing",
"report_url": "",
"account_id": "c0ea266f-b969-4d61-9ca0-e790c79072e5",
"contact_id": "3cae081f-56f7-4f2d-8235-45713b592b43",
"created_at": "2018-11-05T15:12:45+00:00",
"updated_at": "2018-11-05T15:12:45+00:00"
});
nock('https://devapi.currencycloud.com:443')
.get('/v2/reports/report_requests/c2d7dd2c-9317-4517-9f5d-8d287a1c4ee7')
.reply(200, {
"id": "c2d7dd2c-9317-4517-9f5d-8d287a1c4ee7",
"short_reference": "RP-4270806-VLOIID",
"search_params": {
"buy_currency": "EUR",
"sell_currency": "GBP",
"scope": "own"
},
"report_type": "conversion",
"status": "processing",
"report_url": "",
"account_id": "c0ea266f-b969-4d61-9ca0-e790c79072e5",
"contact_id": "3cae081f-56f7-4f2d-8235-45713b592b43",
"created_at": "2018-11-05T15:12:45+00:00",
"updated_at": "2018-11-05T15:12:45+00:00"
});
// Teardown
nock('https://devapi.currencycloud.com:443')
.post('/v2/authenticate/close_session')
.reply(200, {});