Node API update for incorrect invoice and Account Creation
Budget: $30 – $250 AUD
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.
These are the actions:
1) Now it is basing the invoice on a single payment from the subscription plan, which means the invoice only includes one weekly payment, not the total amount of the course. if I just purchased a course for $199 and the invoice was only for $3.48. We need to - rather than basing the invoice on the Payleadr payment plan, the Learnt invoice should just be for the full amount of the order.
2) 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
https://drive.google.com/file/d/1wB_Aax9m6nRsxk4XMTjxZTSY_VKto6a1/view?usp=sharing
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
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.
These are the actions:
1) Now it is basing the invoice on a single payment from the subscription plan, which means the invoice only includes one weekly payment, not the total amount of the course. if I just purchased a course for $199 and the invoice was only for $3.48. We need to - rather than basing the invoice on the Payleadr payment plan, the Learnt invoice should just be for the full amount of the order.
2) 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
https://drive.google.com/file/d/1wB_Aax9m6nRsxk4XMTjxZTSY_VKto6a1/view?usp=sharing
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