0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Cleaned up comments after Stripe Controller refactor (#20943)

no issue
This commit is contained in:
Ronald Langeveld 2024-09-09 14:31:52 +09:00 committed by GitHub
parent a64eaeccf2
commit 499c80673b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 7 deletions

View file

@ -6,7 +6,7 @@ const logging = require('@tryghost/logging');
module.exports = class CheckoutSessionEventService {
constructor(deps) {
this.api = deps.api;
this.deps = deps; // Store the deps object to access repositories dynamically later
this.deps = deps;
}
async handleEvent(session) {
@ -29,7 +29,6 @@ module.exports = class CheckoutSessionEventService {
const amount = session.amount_total;
const currency = session.currency;
// Access the memberRepository dynamically when needed
const memberRepository = this.deps.memberRepository;
const member = session.customer ? (await memberRepository.get({customer_id: session.customer})) : null;
@ -48,11 +47,9 @@ module.exports = class CheckoutSessionEventService {
referrerUrl: session.metadata.referrer_url ?? null
});
// Access the donationRepository dynamically when needed
const donationRepository = this.deps.donationRepository;
await donationRepository.save(data);
// Access the staffServiceEmails dynamically when needed
const staffServiceEmails = this.deps.staffServiceEmails;
await staffServiceEmails.notifyDonationReceived({donationPaymentEvent: data});
}
@ -60,7 +57,6 @@ module.exports = class CheckoutSessionEventService {
async handleSetupEvent(session) {
const setupIntent = await this.api.getSetupIntent(session.setup_intent);
// Access the memberRepository dynamically when needed
const memberRepository = this.deps.memberRepository;
const member = await memberRepository.get({
customer_id: setupIntent.metadata.customer_id
@ -128,7 +124,6 @@ module.exports = class CheckoutSessionEventService {
expand: ['subscriptions.data.default_payment_method']
});
// Access the memberRepository dynamically when needed
const memberRepository = this.deps.memberRepository;
let member = await memberRepository.get({

View file

@ -13,7 +13,6 @@ module.exports = class SubscriptionEventService {
});
}
// Accessing the member repository dynamically from deps
const memberRepository = this.deps.memberRepository;
const member = await memberRepository.get({
customer_id: subscription.customer