Mail Modul überarbeitet, Korrekturen am PaymentService, neuer customerType seller
This commit is contained in:
@@ -58,23 +58,19 @@ export class PaymentService {
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
success_url: 'http://localhost:4200/success',
|
||||
cancel_url: 'http://localhost:4200/pricing',
|
||||
success_url: `${process.env.WEB_HOST}/success`,
|
||||
cancel_url: `${process.env.WEB_HOST}/pricing`,
|
||||
// customer_email: checkout.email,
|
||||
customer: customerId,
|
||||
// customer_details:{
|
||||
// name: checkout.name, // Hier wird der Name des Kunden übergeben
|
||||
// },
|
||||
shipping_address_collection: {
|
||||
allowed_countries: ['US'],
|
||||
},
|
||||
|
||||
client_reference_id: '1234',
|
||||
client_reference_id: btoa(checkout.name),
|
||||
locale: 'en',
|
||||
subscription_data: {
|
||||
trial_end: Math.floor(new Date().setMonth(new Date().getMonth() + 3) / 1000),
|
||||
metadata: { plan: product.name },
|
||||
},
|
||||
metadata: { plan: product.name },
|
||||
});
|
||||
return session;
|
||||
} else {
|
||||
@@ -100,20 +96,11 @@ export class PaymentService {
|
||||
});
|
||||
user.stripeCustomerId = session.customer as string;
|
||||
user.subscriptionId = session.subscription as string;
|
||||
user.planActive = true;
|
||||
//session.shipping_details ->
|
||||
// "shipping_details": {
|
||||
// "address": {
|
||||
// "city": "Springfield",
|
||||
// "country": "US",
|
||||
// "line1": "West Maple Avenue South",
|
||||
// "line2": null,
|
||||
// "postal_code": "62704",
|
||||
// "state": "IL"
|
||||
// },
|
||||
// "name": "Johnathan Miller"
|
||||
// }
|
||||
user.subscriptionPlan = session.amount_total === 4900 ? 'broker' : 'professional'; //session.metadata['subscriptionPlan'] as 'free' | 'professional' | 'broker';
|
||||
user.customerType = 'professional';
|
||||
if (session.metadata['plan'] === 'Broker Plan') {
|
||||
user.customerSubType = 'broker';
|
||||
}
|
||||
user.subscriptionPlan = session.metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional'; //session.metadata['subscriptionPlan'] as 'free' | 'professional' | 'broker';
|
||||
this.userService.saveUser(user);
|
||||
this.mailService.sendSubscriptionConfirmation(user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user