mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-11 00:08:37 +01:00
Services rewrite
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user