@defra-fish/connectors-lib 1.57.0-rc.2 → 1.57.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/connectors-lib",
|
|
3
|
-
"version": "1.57.0-rc.
|
|
3
|
+
"version": "1.57.0-rc.4",
|
|
4
4
|
"description": "Shared connectors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"node-fetch": "^2.6.7",
|
|
42
42
|
"redlock": "^4.2.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "54475774a2f320e8ba0ed1e6baa624e23f14decc"
|
|
45
45
|
}
|
|
@@ -120,10 +120,10 @@ describe('govuk-pay-api-connector', () => {
|
|
|
120
120
|
})
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
-
describe('
|
|
123
|
+
describe('createRecurringPaymentAgreement', () => {
|
|
124
124
|
it('creates new payments', async () => {
|
|
125
125
|
fetch.mockReturnValue({ ok: true, status: 200 })
|
|
126
|
-
await expect(govUkPayApi.
|
|
126
|
+
await expect(govUkPayApi.createRecurringPaymentAgreement({ cost: 0 })).resolves.toEqual({ ok: true, status: 200 })
|
|
127
127
|
expect(fetch).toHaveBeenCalledWith('http://0.0.0.0/agreement', {
|
|
128
128
|
body: JSON.stringify({ cost: 0 }),
|
|
129
129
|
headers: recurringHeaders,
|
|
@@ -137,7 +137,7 @@ describe('govuk-pay-api-connector', () => {
|
|
|
137
137
|
fetch.mockImplementation(() => {
|
|
138
138
|
throw new Error('')
|
|
139
139
|
})
|
|
140
|
-
expect(govUkPayApi.
|
|
140
|
+
expect(govUkPayApi.createRecurringPaymentAgreement({ reference: '123' })).rejects.toEqual(Error(''))
|
|
141
141
|
expect(fetch).toHaveBeenCalledWith('http://0.0.0.0/agreement', {
|
|
142
142
|
body: JSON.stringify({ reference: '123' }),
|
|
143
143
|
headers: recurringHeaders,
|
package/src/govuk-pay-api.js
CHANGED
|
@@ -15,7 +15,7 @@ const headers = recurring => ({
|
|
|
15
15
|
* @param preparedPayment - see the GOV.UK pay API reference for details
|
|
16
16
|
* @returns {Promise<*>}
|
|
17
17
|
*/
|
|
18
|
-
export const
|
|
18
|
+
export const createRecurringPaymentAgreement = async preparedPayment => {
|
|
19
19
|
try {
|
|
20
20
|
return fetch(process.env.GOV_PAY_RCP_API_URL, {
|
|
21
21
|
headers: headers(true),
|