@defra-fish/sales-api-service 1.63.0-rc.6 → 1.63.0-rc.8

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.6",
3
+ "version": "1.63.0-rc.8",
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.6",
39
- "@defra-fish/connectors-lib": "1.63.0-rc.6",
40
- "@defra-fish/dynamics-lib": "1.63.0-rc.6",
38
+ "@defra-fish/business-rules-lib": "1.63.0-rc.8",
39
+ "@defra-fish/connectors-lib": "1.63.0-rc.8",
40
+ "@defra-fish/dynamics-lib": "1.63.0-rc.8",
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": "bb4bf03e0fdf3e8c04b00a1bf10b844475796434"
55
+ "gitHead": "4376fb63f6e1867708241521e43c4bce5791e08a"
56
56
  }
@@ -530,6 +530,15 @@ describe('recurring payments service', () => {
530
530
  await expect(generateRecurringPaymentRecord(sampleTransaction)).rejects.toThrow('Invalid dates provided for permission')
531
531
  })
532
532
 
533
+ it('returns a false flag when recurringPayment is not present', async () => {
534
+ const sampleTransaction = createFinalisedSampleTransaction()
535
+ delete sampleTransaction.recurringPayment
536
+
537
+ const rpRecord = await generateRecurringPaymentRecord(sampleTransaction)
538
+
539
+ expect(rpRecord.payment?.recurring).toBeFalsy()
540
+ })
541
+
533
542
  it('returns a false flag when agreementId is not present', async () => {
534
543
  const sampleTransaction = createFinalisedSampleTransaction(
535
544
  null,
@@ -37,7 +37,7 @@ const getNextDueDate = (startDate, issueDate, endDate) => {
37
37
  }
38
38
 
39
39
  export const generateRecurringPaymentRecord = async (transactionRecord, permission) => {
40
- if (transactionRecord.recurringPayment.agreementId) {
40
+ if (transactionRecord.recurringPayment?.agreementId) {
41
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