mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
Merge pull request #27800 from overleaf/ls-support-create-stripe-customer-from-admin-panel
Support creating Stripe customer from admin panel GitOrigin-RevId: 3e23008e1f4690e6f3737b5689e20958bf468f82
This commit is contained in:
@@ -603,7 +603,7 @@ class PaymentProviderAccount {
|
||||
* @param {object} props
|
||||
* @param {string} props.code
|
||||
* @param {string} props.email
|
||||
* @param {boolean} props.hasPastDueInvoice
|
||||
* @param {boolean} [props.hasPastDueInvoice]
|
||||
*/
|
||||
constructor(props) {
|
||||
this.code = props.code
|
||||
|
||||
@@ -90,7 +90,7 @@ async function createAccountForUserId(userId) {
|
||||
}
|
||||
const account = await client.createAccount(accountCreate)
|
||||
logger.debug({ userId, account }, 'created recurly account')
|
||||
return account
|
||||
return accountFromApi(account)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
GroupPolicy,
|
||||
ManagedGroupSubscription,
|
||||
MemberGroupSubscription,
|
||||
StripePaymentProviderService,
|
||||
} from '../../../types/subscription/dashboard/subscription'
|
||||
import { SplitTestInfo } from '../../../types/split-test'
|
||||
import { ValidationStatus } from '../../../types/group-management/validation'
|
||||
@@ -254,6 +255,7 @@ export interface Meta {
|
||||
'ol-stripeSubscriptionData': {
|
||||
customerId: string
|
||||
subscriptionState: string | null
|
||||
paymentProviderService: StripePaymentProviderService | null
|
||||
}
|
||||
'ol-subscription': any // TODO: mixed types, split into two fields
|
||||
'ol-subscriptionChangePreview': SubscriptionChangePreview
|
||||
|
||||
@@ -193,11 +193,10 @@ describe('RecurlyClient', function () {
|
||||
describe('createAccountForUserId', function () {
|
||||
it('should return the Account as created by recurly', async function () {
|
||||
this.client.createAccount = sinon.stub().resolves(this.recurlyAccount)
|
||||
await expect(
|
||||
this.RecurlyClient.promises.createAccountForUserId(this.user._id)
|
||||
const result = await this.RecurlyClient.promises.createAccountForUserId(
|
||||
this.user._id
|
||||
)
|
||||
.to.eventually.be.an.instanceOf(recurly.Account)
|
||||
.that.has.property('code', this.user._id)
|
||||
expect(result).to.has.property('code', this.user._id)
|
||||
})
|
||||
|
||||
it('should throw any API errors', async function () {
|
||||
|
||||
@@ -17,6 +17,7 @@ export type AdminCapability =
|
||||
| 'view-script-log'
|
||||
| 'view-split-test'
|
||||
| 'view-user-additional-info'
|
||||
| 'create-stripe-account'
|
||||
|
||||
export type AdminRole =
|
||||
| 'engagement'
|
||||
|
||||
@@ -107,11 +107,15 @@ export type MemberGroupSubscription = Omit<GroupSubscription, 'admin_id'> & {
|
||||
admin_id: User
|
||||
}
|
||||
|
||||
type PaymentProviderService = 'stripe-us' | 'stripe-uk' | 'recurly'
|
||||
export type StripePaymentProviderService = Exclude<
|
||||
PaymentProviderService,
|
||||
'recurly'
|
||||
>
|
||||
const STRIPE_PAYMENT_PROVIDER_SERVICES = ['stripe-uk', 'stripe-us'] as const
|
||||
const PAYMENT_PROVIDER_SERVICES = [
|
||||
...STRIPE_PAYMENT_PROVIDER_SERVICES,
|
||||
'recurly',
|
||||
] as const
|
||||
|
||||
export type PaymentProviderService = (typeof PAYMENT_PROVIDER_SERVICES)[number]
|
||||
export type StripePaymentProviderService =
|
||||
(typeof STRIPE_PAYMENT_PROVIDER_SERVICES)[number]
|
||||
|
||||
export type PaymentProvider = {
|
||||
service: PaymentProviderService
|
||||
|
||||
Reference in New Issue
Block a user