@defra-fish/sales-api-service 1.63.0-rc.4 → 1.63.0-rc.5

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/sales-api-service",
3
- "version": "1.63.0-rc.4",
3
+ "version": "1.63.0-rc.5",
4
4
  "description": "Rod Licensing Sales API",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,9 +35,9 @@
35
35
  "test": "echo \"Error: run tests from root\" && exit 1"
36
36
  },
37
37
  "dependencies": {
38
- "@defra-fish/business-rules-lib": "1.63.0-rc.4",
39
- "@defra-fish/connectors-lib": "1.63.0-rc.4",
40
- "@defra-fish/dynamics-lib": "1.63.0-rc.4",
38
+ "@defra-fish/business-rules-lib": "1.63.0-rc.5",
39
+ "@defra-fish/connectors-lib": "1.63.0-rc.5",
40
+ "@defra-fish/dynamics-lib": "1.63.0-rc.5",
41
41
  "@hapi/boom": "^9.1.2",
42
42
  "@hapi/hapi": "^20.1.3",
43
43
  "@hapi/inert": "^6.0.3",
@@ -52,5 +52,5 @@
52
52
  "moment-timezone": "^0.5.34",
53
53
  "uuid": "^8.3.2"
54
54
  },
55
- "gitHead": "19c5ac3cf85aa9f3dc5e7ebc0f14cfe88936125c"
55
+ "gitHead": "313d1d1a8ab65bd841c27cf615f8abeec527f401"
56
56
  }
@@ -110,12 +110,9 @@ describe('createTransactionSchema', () => {
110
110
  await expect(createTransactionSchema.validateAsync(mockPayload)).resolves.not.toThrow()
111
111
  })
112
112
 
113
- it.each([
114
- ['agreement id', { id: 'fdc73d20-a0bf-4da6-9a49-2f0a24bd3509' }],
115
- ['id', { agreementId: 'jhy7u8ii87uyhjui87u89ui8ie' }]
116
- ])('fails validation if %s is omitted from recurring payment detail', async (_d, recurringPayment) => {
113
+ it('fails validation if agreement id is omitted from recurring payment detail', async () => {
117
114
  const mockPayload = mockTransactionPayload()
118
- mockPayload.recurringPayment = recurringPayment
115
+ mockPayload.recurringPayment = { id: 'fdc73d20-a0bf-4da6-9a49-2f0a24bd3509' }
119
116
  await expect(() => createTransactionSchema.validateAsync(mockPayload)).rejects.toThrow()
120
117
  })
121
118
 
@@ -38,7 +38,7 @@ const createTransactionRequestSchemaContent = {
38
38
  transactionId: Joi.string().guid({ version: 'uuidv4' }).optional(),
39
39
  recurringPayment: Joi.object({
40
40
  agreementId: Joi.string().alphanum().length(AGREEMENT_ID_LENGTH).required(),
41
- id: Joi.string().guid().required()
41
+ id: Joi.string().guid()
42
42
  }).optional()
43
43
  }
44
44
 
@@ -392,7 +392,9 @@ describe('recurring payments service', () => {
392
392
  ...permission
393
393
  }
394
394
  ],
395
- agreementId,
395
+ recurringPayment: {
396
+ agreementId
397
+ },
396
398
  payment: {
397
399
  amount: 35.8,
398
400
  source: 'Gov Pay',
@@ -37,8 +37,8 @@ const getNextDueDate = (startDate, issueDate, endDate) => {
37
37
  }
38
38
 
39
39
  export const generateRecurringPaymentRecord = async (transactionRecord, permission) => {
40
- if (transactionRecord.agreementId) {
41
- const agreementResponse = await getRecurringPaymentAgreement(transactionRecord.agreementId)
40
+ if (transactionRecord.recurringPayment.agreementId) {
41
+ const agreementResponse = await getRecurringPaymentAgreement(transactionRecord.recurringPayment.agreementId)
42
42
  const lastDigitsCardNumbers = agreementResponse.payment_instrument?.card_details?.last_digits_card_number
43
43
  const [{ startDate, issueDate, endDate }] = transactionRecord.permissions
44
44
  return {
@@ -49,7 +49,7 @@ export const generateRecurringPaymentRecord = async (transactionRecord, permissi
49
49
  cancelledDate: null,
50
50
  cancelledReason: null,
51
51
  endDate,
52
- agreementId: transactionRecord.agreementId,
52
+ agreementId: transactionRecord.recurringPayment.agreementId,
53
53
  status: 1,
54
54
  last_digits_card_number: lastDigitsCardNumbers
55
55
  }