Skip to content

feat: implement refund service (#165)#196

Open
OSEH-svg wants to merge 1 commit intozendvolabs:mainfrom
OSEH-svg:feat/165-refund-service
Open

feat: implement refund service (#165)#196
OSEH-svg wants to merge 1 commit intozendvolabs:mainfrom
OSEH-svg:feat/165-refund-service

Conversation

@OSEH-svg
Copy link
Copy Markdown

closes #165

Description

This PR addresses issue #165 by implementing the specialized refundService and updating the transactionService to properly handle refund triggers when a gift goes into a rejected or failed state.

The refund logic now correctly caters to:

  • Fiat Transactions (Stripe/Paystack): Dynamically interfaces with the corresponding provider's refund APIs through securely configured HTTP requests and backend wrappers.
  • On-chain Transactions (Stellar): Introduces a placeholder reverse transaction back to the centralized custodial signer's platform balance (as individual sender public key secrets are not stored).
  • Internal Wallet Balances: Safely reverses database ledgers using the newly added processRefundTransaction method safely located within the transactionService.ts.

All changes adhere strictly to the existing file structure without touching any non-explicitly listed files (maintaining the giftStatusEnum schema constraints by standardizing on exactly representing rejection endpoints as "failed").

Changes Made

  • src/server/services/refundService.ts: Introduced the processRefund service method to direct refunds based on paymentProvider origin properties.
  • src/server/services/transactionService.ts: Added processRefundTransaction to cleanly and accurately deduct ledger funds from recipients and apply them back to senders.

Verification

  • Ran complete workspace compilations without triggering typescript errors inside modified contexts.
  • Linter completed specifically with zero errors or warnings inside the modified business logic layer files (src/server/services/refundService.ts & src/server/services/transactionService.ts).

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@OSEH-svg Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Refund Service

1 participant