From 9f6b5db3bfe245840bcb93d20df613ffea3482bd Mon Sep 17 00:00:00 2001 From: Sumesh Punakkal Kariyil Date: Tue, 11 Aug 2020 11:07:08 -0700 Subject: [PATCH] Reverting payment service changes for direct pay --- auth-web/src/routes/router.ts | 6 +----- auth-web/src/services/payment.services.ts | 4 ++-- auth-web/src/views/pay/PaymentReturnView.vue | 4 ++-- auth-web/tests/unit/views/PaymentReturnView.spec.ts | 6 +++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/auth-web/src/routes/router.ts b/auth-web/src/routes/router.ts index 07371db4e5..7887261492 100644 --- a/auth-web/src/routes/router.ts +++ b/auth-web/src/routes/router.ts @@ -45,14 +45,10 @@ import UnauthorizedView from '@/views/auth/UnauthorizedView.vue' import UserProfileView from '@/views/auth/UserProfileView.vue' function mapReturnPayVars (route: any) { - let payResponseUrl = window.location.search - if (payResponseUrl && payResponseUrl.charAt(0) === '?') { - payResponseUrl = payResponseUrl.substr(1) - } return { paymentId: route.params.paymentId, transactionId: route.params.transactionId, - payResponseUrl: payResponseUrl + receiptNum: !route.query.receipt_number ? '' : route.query.receipt_number } } diff --git a/auth-web/src/services/payment.services.ts b/auth-web/src/services/payment.services.ts index eeedddafcd..bc818ab81e 100644 --- a/auth-web/src/services/payment.services.ts +++ b/auth-web/src/services/payment.services.ts @@ -14,10 +14,10 @@ export default class PaymentService { }) } - static updateTransaction (paymentId: string, transactionId: string, payResponseUrl?: string): AxiosPromise { + static updateTransaction (paymentId: string, transactionId: string, receiptNum?: string): AxiosPromise { const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}/transactions/${transactionId}` return axios.patch(url, { - payResponseUrl: payResponseUrl + receipt_number: receiptNum }) } diff --git a/auth-web/src/views/pay/PaymentReturnView.vue b/auth-web/src/views/pay/PaymentReturnView.vue index 614717a4b1..be9cdb9470 100644 --- a/auth-web/src/views/pay/PaymentReturnView.vue +++ b/auth-web/src/views/pay/PaymentReturnView.vue @@ -25,7 +25,7 @@ import SbcSystemError from 'sbc-common-components/src/components/SbcSystemError. export default class PaymentReturnView extends Vue { @Prop() paymentId: string @Prop() transactionId: string - @Prop() payResponseUrl: string + @Prop() receiptNum: string returnUrl:string errorMessage:string = '' // show modal when paybc is down..otherwise [all unhandled technical error , show plain text error message..] @@ -36,7 +36,7 @@ export default class PaymentReturnView extends Vue { this.errorMessage = this.$t('payNoParams').toString() return } - PaymentServices.updateTransaction(this.paymentId, this.transactionId, this.payResponseUrl) + PaymentServices.updateTransaction(this.paymentId, this.transactionId, this.receiptNum) .then(response => { this.returnUrl = response.data.clientSystemUrl if (response.data.paySystemReasonCode && response.data.paySystemReasonCode === 'SERVICE_UNAVAILABLE') { diff --git a/auth-web/tests/unit/views/PaymentReturnView.spec.ts b/auth-web/tests/unit/views/PaymentReturnView.spec.ts index b8281df9b2..bcf8f60d91 100644 --- a/auth-web/tests/unit/views/PaymentReturnView.spec.ts +++ b/auth-web/tests/unit/views/PaymentReturnView.spec.ts @@ -29,12 +29,12 @@ describe('PaymentReturnView.vue', () => { propsData: { paymentId: 'somepaymentId', transactionId: 'sometransactionId', - payResponseUrl: 'someResponseUrl' + receiptNum: 'somereceiptNum' }, mocks: { $t } }) - expect(PaymentServices.updateTransaction).toBeCalledWith('somepaymentId', 'sometransactionId', 'someResponseUrl') + expect(PaymentServices.updateTransaction).toBeCalledWith('somepaymentId', 'sometransactionId', 'somereceiptNum') }) it('service is not invoked when no params are present', () => { PaymentServices.updateTransaction = jest.fn().mockResolvedValue({}) @@ -56,7 +56,7 @@ describe('PaymentReturnView.vue', () => { propsData: { paymentId: 'somepaymentId', transactionId: 'sometransactionId', - payResponseUrl: 'someResponseUrl' + receiptNum: 'somereceiptNum' }, mocks: { $t } })