mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-16 03:46:21 +00:00
Merge pull request #12958 from overleaf/jel-payment-change-currency
[web] Add currency as a dependency of effect and query price with current currency GitOrigin-RevId: 1bbb2c5cd71a0dc23642e9af1eddc4a8a129b7ae
This commit is contained in:
parent
8ff0cf3f1e
commit
44c2b6d2b2
1 changed files with 3 additions and 6 deletions
|
@ -120,13 +120,10 @@ function usePayment({ publicKey }: RecurlyOptions) {
|
|||
country: initialCountry,
|
||||
})
|
||||
.tax({ tax_code: 'digital', vat_number: '' })
|
||||
.currency(initiallySelectedCurrencyCode)
|
||||
.currency(currencyCode)
|
||||
.coupon(initialCouponCode)
|
||||
.catch(function (err) {
|
||||
if (
|
||||
initiallySelectedCurrencyCode !== 'USD' &&
|
||||
err.name === 'invalid-currency'
|
||||
) {
|
||||
if (currencyCode !== 'USD' && err.name === 'invalid-currency') {
|
||||
setCurrencyCode('USD')
|
||||
setupPricing()
|
||||
} else if (err.name === 'api-error' && err.code === 'not-found') {
|
||||
|
@ -206,7 +203,7 @@ function usePayment({ publicKey }: RecurlyOptions) {
|
|||
})()
|
||||
setCoupon(couponData)
|
||||
})
|
||||
}, [])
|
||||
}, [currencyCode])
|
||||
|
||||
const addCoupon = useCallback(
|
||||
(coupon: PricingFormState['coupon']) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue