|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @import { PaymentProvider } from '../../../../types/subscription/dashboard/subscription'
|
|
* @import { PaymentProvider } from '../../../../types/subscription/dashboard/subscription'
|
|
|
|
|
+ * @import { CurrencyCode, StripeCurrencyCode } from '../../../../types/subscription/currency'
|
|
|
* @import { AddOn } from '../../../../types/subscription/plan'
|
|
* @import { AddOn } from '../../../../types/subscription/plan'
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
@@ -28,7 +29,8 @@ class PaymentProviderSubscription {
|
|
|
* @param {number} props.subtotal
|
|
* @param {number} props.subtotal
|
|
|
* @param {number} [props.taxRate]
|
|
* @param {number} [props.taxRate]
|
|
|
* @param {number} [props.taxAmount]
|
|
* @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 {number} props.total
|
|
|
* @param {Date} props.periodStart
|
|
* @param {Date} props.periodStart
|
|
|
* @param {Date} props.periodEnd
|
|
* @param {Date} props.periodEnd
|
|
@@ -54,7 +56,7 @@ class PaymentProviderSubscription {
|
|
|
this.subtotal = props.subtotal
|
|
this.subtotal = props.subtotal
|
|
|
this.taxRate = props.taxRate ?? 0
|
|
this.taxRate = props.taxRate ?? 0
|
|
|
this.taxAmount = props.taxAmount ?? 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.total = props.total
|
|
|
this.periodStart = props.periodStart
|
|
this.periodStart = props.periodStart
|
|
|
this.periodEnd = props.periodEnd
|
|
this.periodEnd = props.periodEnd
|
|
@@ -439,7 +441,7 @@ class PaymentProviderSubscriptionAddOnUpdate {
|
|
|
*/
|
|
*/
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
this.code = props.code
|
|
this.code = props.code
|
|
|
- this.quantity = props.quantity ?? null
|
|
|
|
|
|
|
+ this.quantity = props.quantity
|
|
|
this.unitPrice = props.unitPrice ?? null
|
|
this.unitPrice = props.unitPrice ?? null
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -560,7 +562,7 @@ class PaymentProviderCoupon {
|
|
|
* @param {object} props
|
|
* @param {object} props
|
|
|
* @param {string} props.code
|
|
* @param {string} props.code
|
|
|
* @param {string} props.name
|
|
* @param {string} props.name
|
|
|
- * @param {string} props.description
|
|
|
|
|
|
|
+ * @param {string} [props.description]
|
|
|
*/
|
|
*/
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
this.code = props.code
|
|
this.code = props.code
|