hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

[FEAT] Payment Receipt Mail #68

Closed Umaradigun closed 1 month ago

Umaradigun commented 1 month ago

Description

Develop the backend logic to handle sending payment receipts to users after a successful transaction.

Acceptance Criteria

  1. Payment Confirmation

    • Order Checkout: The payment receipt should only be sent after the order has been successfully checked out.
      • Criteria: The POST /api/v1/checkout endpoint must indicate that the payment has been completed successfully, returning a confirmation status.
      • Validation: Ensure that the POST /api/v1/sendPaymentReceipt endpoint is only triggered after a successful checkout response with a status code of 200 OK and a success message.
  2. Receipt Generation

    • Receipt Details: Generate a receipt with accurate transaction details.
      • Criteria: The receipt must include:
      • Transaction ID
      • Amount paid
      • Currency
      • Payment date
      • User’s name and email
      • Company or service details (name, contact information, etc.)
      • A thank-you message or confirmation note
  3. Email Delivery

    • Email Sent: Send the payment receipt to the user’s email address.
      • Criteria: The receipt must be sent via a secure email service provider (e.g., SendGrid, Mailgun).
      • Validation: Check that the receipt email is delivered successfully and includes all relevant details.

Purpose

To send payment receipts and store receipt logs securely, ensuring clear and reliable communication with users about their transactions.

Requirements

Expected Outcome

 - The backend should send payment receipts securely and efficiently.
 - The system should log receipt transactions and handle errors appropriately.

Endpoints

POST /api/v1/sendPaymentReceipt

Send Payment Receipt

Description: Send a receipt to the user after a successful payment.
Endpoint: POST /api/v1/sendPaymentReceipt

Request Body:

{
  "userId": "String",
  "name": "String",
  "email": "String",
  "transactionId": "String",
  "amount": "Number",
  "currency": "String",
  "date": "String",
  "company": {
    "name": "String",
    "email": "String"
  },
  "message": "String"
}

Tasks

Testing

markessien commented 1 month ago

We do not have a payments endpoint in this app, so this is redundant