We need to update the endpoint - sendInvoiceToCustomer, the goal for the API is - once the payment goes through to Payleadr, kick off the Learnt account creation process, generate the pdf invoice and attach that to the welcome email (There are pdf invoice and welcome email examples for other payments in the project, like afterpay, credit card, you can follow them).
Now, the invoice and email can be generated and sent, but the total price in the invoice is incorrect and it does not create an account for the user.
This function doesn't actually create the Learnt account so even though the user is getting sent an invoice they do not actually have access to the course they have purchased. This needs to follow the same steps as handlePaymentIntentSuccess does for stripe payments where it makes various checks and then sets up the customer account
Please review handlePaymentIntentSuccess and if you look at the comments there are 10 steps that goes through - we need to do the same things for Paylaedr payments but instead of getting the customer data from stripe, we get it from Payleadr.
/1. Get customer data from paylaedr
//2. check if valid customer type
//3. get relevant customer application repository based on customer type
//4. get relevant customer application
//5. get relevant customer transaction repository based on customer type
//6. get relevant customer transaction document by paymentIntentId
//7. check if customer has valid earn qantas rewards settings
//8. create relevant customer transaction document
//9. Earn points for customer (if relevant based on #7)
//10. setup customer account
[login to view URL]
payleadr info: https://www.freelancer.com/projects/nodejs/Website-need-integrate-Pay-Leader/details
You can test the 7 payleadr APIs in the attached collection, the last API is the one that needs to be updated, in param- planId of the last API has to be gotten from API addSubscriptionPlan in this collection
17 freelanceria on tarjonnut keskimäärin $289 tähän työhön