Services rewrite

This commit is contained in:
Emily
2024-09-18 17:43:04 +02:00
parent fa5a37ece2
commit 0be3dbecbf
40 changed files with 488146 additions and 125 deletions

View File

@@ -56,7 +56,7 @@ class StripeService {
return checkout;
}
async cretePayment(price: string, success_url: string, pid: string, customer?: string) {
async createPayment(price: string, success_url: string, pid: string, customer?: string) {
if (this.disabledMode) return;
if (!this.stripe) throw Error('Stripe not initialized');
@@ -126,6 +126,22 @@ class StripeService {
return customer;
}
async setCustomerInfo(customer_id: string, address: { line1: string, line2: string, city: string, country: string, postal_code: string, state: string }) {
if (this.disabledMode) return;
if (!this.stripe) throw Error('Stripe not initialized');
const customer = await this.stripe.customers.update(customer_id, {
address: {
line1: address.line1,
line2: address.line2,
city: address.city,
country: address.country,
postal_code: address.postal_code,
state: address.state
}
})
return customer.id;
}
async deleteCustomer(customer_id: string) {
if (this.disabledMode) return;
if (!this.stripe) throw Error('Stripe not initialized');