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

Fix the credit card verification #7376

Merged
merged 1 commit into from
Aug 13, 2024
Merged

Conversation

rezbyte
Copy link
Contributor

@rezbyte rezbyte commented Aug 12, 2024

This fixes the currency symbol being included and the decimal separator in the call to the Braintree card verification causing it to fail.

It is not possible to have getSubscriptionPriceWithCurrency return without currency formatting because the return of getPlanPrices cannot be changed as StoreKit can only return the price in the local currency.

Closes #7370.

@rezbyte rezbyte requested a review from paw-hub August 13, 2024 09:00
Copy link
Contributor

@paw-hub paw-hub left a comment

Choose a reason for hiding this comment

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

Looks good! Just one minor edit I'd recommend.

}
}
throw new Error(`no such iOS plan ${planName}`)
} else {
const displayPrice = formatPrice(price, true)
return { displayPrice, rawPrice: rawPrice.toString() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return { displayPrice, rawPrice: rawPrice.toString() }
return { displayPrice, rawPrice }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I will change it.

case PaymentInterval.Yearly:
return mobilePlan.yearlyPerYear
return { displayPrice: mobilePlan.yearlyPerYear, rawPrice: rawPrice.toString() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return { displayPrice: mobilePlan.yearlyPerYear, rawPrice: rawPrice.toString() }
return { displayPrice: mobilePlan.yearlyPerYear, rawPrice }

if (isIOSApp()) {
const planName = PlanTypeToName[subscription]
const mobilePlan = this.getMobilePrices().get(planName.toLowerCase())
if (mobilePlan) {
switch (paymentInterval) {
case PaymentInterval.Monthly:
return mobilePlan.monthlyPerMonth
return { displayPrice: mobilePlan.monthlyPerMonth, rawPrice: rawPrice.toString() }
Copy link
Contributor

Choose a reason for hiding this comment

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

You already have rawPrice as a string, so you needn't convert it again.

Suggested change
return { displayPrice: mobilePlan.monthlyPerMonth, rawPrice: rawPrice.toString() }
return { displayPrice: mobilePlan.monthlyPerMonth, rawPrice }

This fixes the currency symbol being included and the decimal separator
in the call to the Braintree card verification causing it to fail.

It is not possible to have `getSubscriptionPriceWithCurrency` return
without currency formatting because the return of `getPlanPrices` cannot
be changed as `StoreKit` can only return the price in the
local currency.

Closes #7370.

Co-authored-by: wec <wec@tutao.de>
@rezbyte rezbyte force-pushed the 7370-invalid-card-verification branch from da15044 to 6832af6 Compare August 13, 2024 11:31
@rezbyte rezbyte merged commit 6832af6 into master Aug 13, 2024
1 check passed
@rezbyte rezbyte deleted the 7370-invalid-card-verification branch August 13, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants