From 7a80c7620dc68478ca4bf75ae536fa2c493a10fb Mon Sep 17 00:00:00 2001 From: Yves Liu Date: Wed, 6 Jul 2022 04:30:41 -0700 Subject: [PATCH] Fix google pay signed message (#234) Signed-off-by: Yves Liu --- pages/debug/payments/digitalWallets/paymenttokens.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/debug/payments/digitalWallets/paymenttokens.vue b/pages/debug/payments/digitalWallets/paymenttokens.vue index 868e4a5f..ad59d22f 100644 --- a/pages/debug/payments/digitalWallets/paymenttokens.vue +++ b/pages/debug/payments/digitalWallets/paymenttokens.vue @@ -302,12 +302,12 @@ export default class ConvertToken extends Vue { const callback = (paymentData: PaymentData) => { const paymentTokenString = paymentData.paymentMethodData.tokenizationData.token // payment token as JSON string - console.log('Token before it is parsed') - console.log(paymentTokenString) const paymentToken: GooglePayTokenData = JSON.parse(paymentTokenString) // payment token as object with keys protocolVersion, signature, and signedMessage this.googlePayTokenData.protocolVersion = paymentToken.protocolVersion this.googlePayTokenData.signature = paymentToken.signature - this.googlePayTokenData.signedMessage = paymentToken.signedMessage.trim() + // Due to the parse earlier, the escaped double quotes were changed. need to change them back. + this.googlePayTokenData.signedMessage = + paymentToken.signedMessage.replace(/"/g, '\\"') this.displayGoogleTokens = true } onGooglePayClicked(this.formData.amount, callback) @@ -322,7 +322,7 @@ export default class ConvertToken extends Vue { tokenData = { protocolVersion: this.googlePayTokenData.protocolVersion, signature: this.googlePayTokenData.signature, - signedMessage: JSON.stringify(this.googlePayTokenData.signedMessage), + signedMessage: this.googlePayTokenData.signedMessage, } break case 'applepay':