Skip to content

Commit

Permalink
Merge pull request #954 from sumesh-aot/revert_direct_pay
Browse files Browse the repository at this point in the history
Reverting payment service changes for direct pay
  • Loading branch information
sumesh-aot authored Aug 11, 2020
2 parents 105e455 + 9f6b5db commit 957ebce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
6 changes: 1 addition & 5 deletions auth-web/src/routes/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions auth-web/src/services/payment.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export default class PaymentService {
})
}

static updateTransaction (paymentId: string, transactionId: string, payResponseUrl?: string): AxiosPromise<any> {
static updateTransaction (paymentId: string, transactionId: string, receiptNum?: string): AxiosPromise<any> {
const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}/transactions/${transactionId}`
return axios.patch(url, {
payResponseUrl: payResponseUrl
receipt_number: receiptNum
})
}

Expand Down
4 changes: 2 additions & 2 deletions auth-web/src/views/pay/PaymentReturnView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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..]
Expand All @@ -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') {
Expand Down
6 changes: 3 additions & 3 deletions auth-web/tests/unit/views/PaymentReturnView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({})
Expand All @@ -56,7 +56,7 @@ describe('PaymentReturnView.vue', () => {
propsData: {
paymentId: 'somepaymentId',
transactionId: 'sometransactionId',
payResponseUrl: 'someResponseUrl'
receiptNum: 'somereceiptNum'
},
mocks: { $t }
})
Expand Down

0 comments on commit 957ebce

Please sign in to comment.