2.0 KiB
2.0 KiB
Summary
When redeeming a receiveCode, if PaymentDetails are passed through instead of a PaymentInstrument, then it should be processed as a new Credit / Credit card.
This revision connects the receivecode_controller
to pay-with-saved-details/redeem-receivecode/redeem.js
Details
pay-with-saved-details/redeem-receivecode/redeem.js
was created to process using a receiveCode with new Payment Details instead of an exising Payment Instrument.
Unit tests were create to test this new functionality.
Test Plan:
- All unit tests run and pass
- Test results for blah are:
aquirers.worldpay.pay-directly.redeem-receivecode.redeem
User redeems receivecode with given credit or debit card
✓ it finds the receivecode and updates it from Pending to Payment Started
✓ it decrypts the worldpay data
✓ calls makePayment correctly
✓ it deletes the receivecode
✓ returns a success
can't find the receivecode to update the Status to Paid
✓ it finds the receivecode and updates it from Pending to Payment Started
✓ it updates receivecode Status from Payment Started to Paid
✓ it decrypts worldpay the data
✓ it fails to make the payment
✓ returns a success
Worldpay rejects the payment
✓ it finds the receivecode and updates it from Pending to Payment Started
✓ it updates receivecode Status from Payment Started to Pending
✓ it decrypts worldpay the data
✓ it fails to make the payment
✓ throws an error
fails to update the receivecode Status to Paid
✓ it finds the receivecode and updates it from Pending to Payment Started
✓ it updates receivecode Status from Payment Started to Paid
✓ it decrypts worldpay the data
✓ it fails to make the payment
✓ returns a success
Failures
can't find the receivecode instrument on DB
✓ returns error
21 passing (85ms)