Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: implement PeachPaymentsGateway (South Africa, Kenya, Nigeria) #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
feat: implement PeachPaymentsGateway (South Africa, Kenya, Nigeria) #35
Changes from all commits
ebbbaa8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded refund currency breaks multi-currency support.
Line 196 hardcodes
"ZAR"as the refund currency, but Peach Payments supports ZAR, KES, NGN, BWP, and USD according to the PR objectives and gateway documentation. Refunds for transactions in other currencies will fail or be rejected by the API.The
RefundRequestdoesn't include a currency field, so you'll need to retrieve the original transaction's currency. The calling code inPaymentService.RefundPaymentAsyncalready loads the transaction from the repository (line 173 in PaymentService.cs), so the currency should be available there.🐛 Recommended fix: pass currency through RefundRequest
Option 1: Add
Currencyproperty toRefundRequestand populate it inPaymentService:In
RefundRequest:public class RefundRequest { public string TransactionReference { get; set; } public decimal Amount { get; set; } + public string Currency { get; set; } public string Reason { get; set; } }In
PaymentService.RefundPaymentAsync(around line 173):+request.Currency = transaction.Currency; var response = await _gateways[selectedGateway].RefundPaymentAsync(request);In
PeachPaymentsGateway.RefundPaymentAsync:var formData = new Dictionary<string, string> { ["entityId"] = _config.PeachPayments.EntityId, ["amount"] = request.Amount.ToString("F2", System.Globalization.CultureInfo.InvariantCulture), - ["currency"] = "ZAR", + ["currency"] = request.Currency ?? "ZAR", ["paymentType"] = "RF", };🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: teesofttech/PayBridge
Length of output: 3517
Fix Peach Payments first-priority routing for unsupported currencies (XOF/XAF/MWK) + check NGN routing
PayBridge.SDK/Gateways/PeachPaymentsGateway.csexplicitly documents supported currencies as ZAR, KES, NGN, BWP, USD and maps only those currencies to countries (CurrencyToCountryhasZAR/KES/NGN/BWP, defaulting toZA). It does not mention XOF/XAF/MWK, so routing those currencies toPaymentGatewayType.PeachPayments(first priority) appears inconsistent with the gateway’s own documentation.Also re-check
PayBridge.SDK/Services/PaymentService.csaround theNGNrouting (line ~252) to ensure it includesPeachPaymentsas intended, since the existing logic may routeNGNwithoutPeachPaymentsdespite Nigeria being in the gateway summary.🤖 Prompt for AI Agents