Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apple pay convert tokens on stg #189

Merged
merged 5 commits into from
Mar 11, 2022

Conversation

elizalucas
Copy link
Contributor

@elizalucas elizalucas commented Mar 10, 2022

This PR adds the applepay button to the /converttokens page on stg. It gets the apple pay tokens and displays them on the page, and then uses the token to call the /paymenttokens endpoint.

I created a second onpaymentauthorized event handler that gets the apple pay token but doesn't facilitate the payment.

@@ -0,0 +1,196 @@
import axios from 'axios'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overly copy-paste of applepay?
Can common part be exported ?

@@ -275,3 +325,16 @@ export default class ConvertToken extends Vue {
}
}
</script>

<style scoped>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not copy paste style, extract it and import it

<style> @import './assets/styles/.....apple_stuff__.css'; </style>

lib/applePay.ts Outdated
console.log('received authorization')
console.log(event.payment)
console.log(JSON.stringify(event.payment.token))
tokens = event.payment.token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you write it so that tokens variable doesn't exist in applePay
that is a lib, by adding tokens to lib you are making a static singleton context

would you write it so that you paste in this method a reference to an object tokens
which is instantiated on the page that uses it

@@ -218,6 +240,34 @@ export default class ConvertToken extends Vue {
}
}

onApplePayButtonClicked() {
startApplePaySessionFrontendPay({
currencyCode:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this anonymous config object, is it a copy paste ?

if so you can define it as const with these fields and expose and use in both places

appleSession.onpaymentauthorized = function (
event: ApplePayJS.ApplePayPaymentAuthorizedEvent
) {
console.log('received authorization')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can leave console logs if you are still developing
but remember to remove them (these should not exist once in prod/sandbox)

@huaweigu huaweigu merged commit dcc8eaa into circlefin:master Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants