mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Merged v5.22.4 into main
v5.22.4
This commit is contained in:
commit
ab678c3a90
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ghost-admin",
|
||||
"version": "5.22.3",
|
||||
"version": "5.22.4",
|
||||
"description": "Ember.js admin client for Ghost",
|
||||
"author": "Ghost Foundation",
|
||||
"homepage": "http://ghost.org",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ghost",
|
||||
"version": "5.22.3",
|
||||
"version": "5.22.4",
|
||||
"description": "The professional publishing platform",
|
||||
"author": "Ghost Foundation",
|
||||
"homepage": "https://ghost.org",
|
||||
|
@ -165,7 +165,7 @@ describe('Create Stripe Checkout Session', function () {
|
||||
if (uri === '/v1/checkout/sessions') {
|
||||
const bodyJSON = querystring.parse(body);
|
||||
// TODO: Actually work out what Stripe checks and when/how it errors
|
||||
if (bodyJSON.customerEmail) {
|
||||
if (Reflect.has(bodyJSON, 'customerEmail')) {
|
||||
return [400, {error: 'Invalid Email'}];
|
||||
}
|
||||
return [200, {id: 'cs_123', url: 'https://site.com'}];
|
||||
|
@ -88,14 +88,19 @@ class PaymentsService {
|
||||
|
||||
const email = options.email || null;
|
||||
|
||||
const session = await this.stripeAPIService.createCheckoutSession(price.id, customer, {
|
||||
const data = {
|
||||
metadata,
|
||||
successUrl: options.successUrl,
|
||||
cancelUrl: options.cancelUrl,
|
||||
customerEmail: customer ? email : null,
|
||||
trialDays: trialDays ?? tier.trialDays,
|
||||
coupon: coupon?.id
|
||||
});
|
||||
};
|
||||
|
||||
if (!customer && email) {
|
||||
data.customerEmail = email;
|
||||
}
|
||||
|
||||
const session = await this.stripeAPIService.createCheckoutSession(price.id, customer, data);
|
||||
|
||||
return session.url;
|
||||
}
|
||||
@ -108,9 +113,7 @@ class PaymentsService {
|
||||
for (const row of rows) {
|
||||
const customer = await this.stripeAPIService.getCustomer(row.customer_id);
|
||||
if (!customer.deleted) {
|
||||
return {
|
||||
id: customer.id
|
||||
};
|
||||
return customer;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user