Skip to content

Commit

Permalink
Fix google pay signed message (#234)
Browse files Browse the repository at this point in the history
Signed-off-by: Yves Liu <yves.liu@circle.com>
  • Loading branch information
Yves-liu committed Jul 6, 2022
1 parent e7a7699 commit 7a80c76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages/debug/payments/digitalWallets/paymenttokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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':
Expand Down

0 comments on commit 7a80c76

Please sign in to comment.