mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 15:10:48 +02:00
Merge pull request #26639 from overleaf/kh-support-stripe-us
[web] support regional Stripe accounts GitOrigin-RevId: d414d310d8db495635d8e0d3b057e3f56b2f044e
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
/**
|
||||
* @import { PaymentProvider } from '../../../../types/subscription/dashboard/subscription'
|
||||
* @import { CurrencyCode, StripeCurrencyCode } from '../../../../types/subscription/currency'
|
||||
* @import { AddOn } from '../../../../types/subscription/plan'
|
||||
*/
|
||||
|
||||
@@ -28,7 +29,8 @@ class PaymentProviderSubscription {
|
||||
* @param {number} props.subtotal
|
||||
* @param {number} [props.taxRate]
|
||||
* @param {number} [props.taxAmount]
|
||||
* @param {string} props.currency
|
||||
* // Recurly uses uppercase currency codes, but Stripe uses lowercase
|
||||
* @param {CurrencyCode | StripeCurrencyCode} props.currency
|
||||
* @param {number} props.total
|
||||
* @param {Date} props.periodStart
|
||||
* @param {Date} props.periodEnd
|
||||
@@ -54,7 +56,7 @@ class PaymentProviderSubscription {
|
||||
this.subtotal = props.subtotal
|
||||
this.taxRate = props.taxRate ?? 0
|
||||
this.taxAmount = props.taxAmount ?? 0
|
||||
this.currency = props.currency
|
||||
this.currency = props.currency.toUpperCase() // ensure that currency codes are always uppercase
|
||||
this.total = props.total
|
||||
this.periodStart = props.periodStart
|
||||
this.periodEnd = props.periodEnd
|
||||
@@ -439,7 +441,7 @@ class PaymentProviderSubscriptionAddOnUpdate {
|
||||
*/
|
||||
constructor(props) {
|
||||
this.code = props.code
|
||||
this.quantity = props.quantity ?? null
|
||||
this.quantity = props.quantity
|
||||
this.unitPrice = props.unitPrice ?? null
|
||||
}
|
||||
}
|
||||
@@ -560,7 +562,7 @@ class PaymentProviderCoupon {
|
||||
* @param {object} props
|
||||
* @param {string} props.code
|
||||
* @param {string} props.name
|
||||
* @param {string} props.description
|
||||
* @param {string} [props.description]
|
||||
*/
|
||||
constructor(props) {
|
||||
this.code = props.code
|
||||
|
||||
@@ -28,6 +28,7 @@ const RecurlyMetrics = require('./RecurlyMetrics')
|
||||
* @import { PaymentProviderSubscriptionChangeRequest } from './PaymentProviderEntities'
|
||||
* @import { PaymentProviderSubscriptionUpdateRequest } from './PaymentProviderEntities'
|
||||
* @import { PaymentMethod } from './types'
|
||||
* @import { CurrencyCode } from '../../../../types/subscription/currency'
|
||||
*/
|
||||
|
||||
class RecurlyClientWithErrorHandling extends recurly.Client {
|
||||
@@ -488,7 +489,7 @@ function subscriptionFromApi(apiSubscription) {
|
||||
taxRate: apiSubscription.taxInfo?.rate ?? 0,
|
||||
taxAmount: apiSubscription.tax ?? 0,
|
||||
total: apiSubscription.total,
|
||||
currency: apiSubscription.currency,
|
||||
currency: /** @type {CurrencyCode} */ (apiSubscription.currency),
|
||||
periodStart: apiSubscription.currentPeriodStartedAt,
|
||||
periodEnd: apiSubscription.currentPeriodEndsAt,
|
||||
collectionMethod: apiSubscription.collectionMethod,
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export type StripeRegion = 'us' | 'uk'
|
||||
@@ -8,7 +8,12 @@ import {
|
||||
} from '../plan'
|
||||
import { User } from '../../user'
|
||||
|
||||
export type SubscriptionState = 'active' | 'canceled' | 'expired' | 'paused'
|
||||
export type SubscriptionState =
|
||||
| 'active'
|
||||
| 'canceled'
|
||||
| 'expired'
|
||||
| 'paused'
|
||||
| 'past_due'
|
||||
|
||||
// when puchasing a new add-on in recurly, we only need to provide the code
|
||||
export type PurchasingAddOnCode = {
|
||||
|
||||
Reference in New Issue
Block a user