From 18d9e176d64e2bb3eba8c08c368d948675da25d5 Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Fri, 28 May 2021 07:02:03 -0700 Subject: [PATCH 1/2] 7653 Send staff payment data --- src/mixins/payment-mixin.ts | 43 ++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/src/mixins/payment-mixin.ts b/src/mixins/payment-mixin.ts index 14eb28c80..d9a1bdf11 100644 --- a/src/mixins/payment-mixin.ts +++ b/src/mixins/payment-mixin.ts @@ -4,12 +4,13 @@ import { AxiosRequestConfig } from 'axios' import { ACCEPTED, CREATED, NO_CONTENT, OK } from 'http-status-codes' import { SessionStorageKeys } from 'sbc-common-components/src/util/constants' -import { PaymentStatus } from '@/enums' +import { PaymentStatus, StaffPaymentOptions } from '@/enums' import { ActionMixin } from '@/mixins' import * as paymentTypes from '@/modules/payment/store/types' import { CreatePaymentParams, NameRequestPaymentResponse } from '@/modules/payment/models' import errorModule from '@/modules/error' import { ErrorI } from '@/modules/error/store/actions' +import { StaffPaymentIF } from '@/interfaces' import { ActionBindingIF } from '@/interfaces/store-interfaces' import NamexServices from '@/services/namex.services' @@ -25,6 +26,7 @@ export class PaymentMixin extends Mixins(ActionMixin) { // Global getter @Getter getCurrentJsDate!: Date + @Getter getStaffPayment!: StaffPaymentIF get sbcPayment () { return this.$store.getters[paymentTypes.GET_SBC_PAYMENT] @@ -148,14 +150,14 @@ export class PaymentMixin extends Mixins(ActionMixin) { } const token = sessionStorage.getItem(SessionStorageKeys.KeyCloakToken) const accountInfo = sessionStorage.getItem(SessionStorageKeys.CurrentAccount) - let headers = {} - if (token && accountInfo) { + let headers = this.buildStaffPayment() + if (token) { + headers['Authorization'] = `Bearer ${token}` + headers['Content-Type'] = 'application/json' + } + if (accountInfo) { const parsedAccountInfo = JSON.parse(accountInfo) - headers = { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json', - 'Account-Id': parsedAccountInfo.id - } + headers['Account-Id'] = parsedAccountInfo.id } req.headers = headers try { @@ -189,6 +191,31 @@ export class PaymentMixin extends Mixins(ActionMixin) { } } + /** Build Staff Payment data. **/ + buildStaffPayment () { + // Populate Staff Payment according to payment option + let headers = {} + switch (this.getStaffPayment.option) { + case StaffPaymentOptions.FAS: + headers['routingSlipNumber'] = this.getStaffPayment.routingSlipNumber + break + + case StaffPaymentOptions.BCOL: + headers['bcolAccountNumber'] = this.getStaffPayment.bcolAccountNumber + headers['datNumber'] = this.getStaffPayment.datNumber + headers['folioNumber'] = this.getStaffPayment.folioNumber // this overrides original folio number + break + + case StaffPaymentOptions.NO_FEE: + headers['waiveFees'] = true + break + + case StaffPaymentOptions.NONE: // should never happen + break + } + return headers + } + /** * Redirect user to Service BC Pay Portal. * Set the redirect URL to specify OUR payment ID so we can From cc85c1d42a511332a6e459c4abd9e334cafc9ff3 Mon Sep 17 00:00:00 2001 From: "vysakh.menon" Date: Fri, 28 May 2021 09:50:10 -0700 Subject: [PATCH 2/2] version upgrade --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff1dbad8e..25c9b2b57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "name-request", - "version": "2.2.3", + "version": "2.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4f890aa37..8ef2c2167 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "name-request", - "version": "2.2.3", + "version": "2.2.4", "private": true, "appName": "Name Request UI", "sbcName": "SBC Common Components",