Implement POST /api/coin-purchases with Payment Validation #33

Closed
opened 2025-11-20 22:14:15 +00:00 by KZix · 0 comments
Owner

Acceptance Criteria:

  • Validate Payload: Ensure euros is positive and payment_type is valid.

  • Validate Payment References (Mock Gateway):

    • MBWAY: 9 digits, starting with '9'.
    • IBAN: 2 letters + 23 digits.
    • MB: Format 12345-123456789.
    • VISA: 16 digits, starting with '4'.
    • PAYPAL: Valid email format.
  • Atomic Transaction: Create record in coin_transactions AND coin_purchases within a DB transaction.

  • Update Balance: Increment users.coins_balance correctly.

  • Response: Return 201 Created with the new balance and transaction ID.

  • Security: Return 401 if unauthorized.

**Acceptance Criteria:** - [ ] Validate Payload: Ensure euros is positive and payment_type is valid. - [ ] Validate Payment References (Mock Gateway): - MBWAY: 9 digits, starting with '9'. - IBAN: 2 letters + 23 digits. - MB: Format 12345-123456789. - VISA: 16 digits, starting with '4'. - PAYPAL: Valid email format. - [ ] Atomic Transaction: Create record in coin_transactions AND coin_purchases within a DB transaction. - [ ] Update Balance: Increment users.coins_balance correctly. - [ ] Response: Return 201 Created with the new balance and transaction ID. - [ ] Security: Return 401 if unauthorized.
KZix added the paymentcoinsfeatureapi labels 2025-11-20 22:14:15 +00:00
KZix added this to the Bisca - API project 2025-11-20 22:14:15 +00:00
FernandoJVideira moved this to In Progress in Bisca - API on 2025-12-30 11:12:23 +00:00
KZix changed title from Create POST /api/coin-purchases endpoint to Implement POST /api/coin-purchases with Payment Validation 2025-12-30 20:17:31 +00:00
Edd closed this issue 2025-12-31 11:07:52 +00:00
Edd moved this to Done in Bisca - API on 2025-12-31 11:07:56 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SyntaxSquad/DADProject#33