Skip to content

Commit

Permalink
# Fixing validations on payment confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
maurok committed May 18, 2017
1 parent 91e47c8 commit ba9ac5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Node/sample-payments/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ function processPayment(paymentRequest, paymentResponse) {
var paymentToken = PaymentToken.parse(paymentResponse.details.paymentToken);
checkParam(paymentToken, 'parsed paymentToken');
checkParam(paymentToken.source, 'Payment token source is empty.');
if (paymentToken.header.Format !== 'Stripe') {
if (paymentToken.header.format !== PaymentToken.tokenFormat.Stripe) {
throw new Error('Payment token format is not Stripe.');
}

if (paymentToken.header.MerchantId !== process.env.PAYMENTS_MERCHANT_ID) {
if (paymentToken.header.merchantId !== process.env.PAYMENTS_MERCHANT_ID) {
throw new Error('MerchantId is not supported.');
}

if (paymentToken.header.Amount.currency !== paymentRequest.details.total.amount.currency ||
paymentToken.header.Amount.value !== paymentRequest.details.total.amount.value) {
if (paymentToken.header.amount.currency !== paymentRequest.details.total.amount.currency ||
paymentToken.header.amount.value !== paymentRequest.details.total.amount.value) {
throw new Error('Payment token amount currency/amount mismatch.');
}

Expand Down

0 comments on commit ba9ac5c

Please sign in to comment.