Business Manager Orders: PSP reference linking for partial payment orders#1444
Conversation
Show both PSP reference links for partial payment orders
Summary of ChangesHello @milica-popovic-yemora, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where Business Manager was incorrectly displaying only the last PSP reference for partial payment orders. By shifting to a transaction-based PSP reference resolution, the system now accurately links each payment instrument to its specific PSP reference, significantly improving the clarity and usability of order details for multi-payment scenarios. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the issue of displaying PSP references for partial payments by iterating through payment instruments. The core logic change is sound. However, I've identified a couple of areas for improvement in the implementation. The new logic for multiple payments introduces invalid HTML and UI inconsistencies compared to the single payment view. I've provided a suggestion to refactor this into a single, simplified loop that handles all cases correctly and consistently. I've also included a minor suggestion to improve code conciseness.
| <isif condition="${order.getPaymentInstruments().size() > 1}"> | ||
| <isloop items="${order.getPaymentInstruments()}" var="paymentInstrument" status="piStatus"> | ||
| <tr> | ||
| <isif condition="${paymentInstrument.paymentTransaction.custom.Adyen_pspReference != null}"> | ||
| <td class='infobox_title'>PSP reference</td> | ||
| <td class='infobox_item'> | ||
| <A target='new' HREF='https://ca-${urlPrefixType}.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=${paymentInstrument.paymentTransaction.custom.Adyen_pspReference}&txType=Payment'> | ||
| <isprint value="${paymentInstrument.paymentTransaction.custom.Adyen_pspReference}"> | ||
| </A> | ||
| </td> | ||
| <td class='infobox_item'><isprint value="${paymentInstrument.custom.adyenPaymentMethod}"></td> | ||
| </isif> | ||
| </tr> | ||
| </isloop> | ||
| <iselse/> | ||
| <tr> | ||
| <td class='infobox_title'>PSP reference</td> | ||
| <td class='infobox_item'> | ||
| <A target='new' HREF='https://ca-${urlPrefixType}.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=${order.custom.Adyen_pspReference}&txType=Payment'> | ||
| <isprint value="${order.custom.Adyen_pspReference}"> | ||
| </A> | ||
| </td> | ||
| </tr> | ||
| <tr><td class='infobox_title'>Payment Method</td><td class='infobox_item'><isprint value="${order.custom.Adyen_paymentMethod}"></td></tr> | ||
| </isif> | ||
|
|
There was a problem hiding this comment.
The logic to handle single and multiple payment instruments can be greatly simplified. The current implementation has a few issues:
- Code Duplication: The
<isif>and<iselse>blocks contain very similar logic for displaying payment information. - Inconsistent UI: The layout for multiple payments (three columns in one row) is different from the single payment layout (two columns over two rows).
- Invalid HTML: The multi-payment case renders three
<td>elements in a<tr>, but the table's<thead>only defines two columns, which is invalid HTML and can cause rendering issues. - Empty Rows: The loop for multiple payments can render empty
<tr>elements if a payment instrument has no PSP reference.
A single loop over all payment instruments can handle all cases (0, 1, or many) correctly and consistently. This removes the need for the isif/iselse check on the number of instruments and resolves all the issues mentioned above.
<isloop items="${order.getPaymentInstruments()}" var="paymentInstrument" status="piStatus">
<isif condition="${paymentInstrument.paymentTransaction.custom.Adyen_pspReference != null}">
<tr>
<td class='infobox_title'>PSP reference</td>
<td class='infobox_item'>
<A target='new' HREF='https://ca-${urlPrefixType}.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=${paymentInstrument.paymentTransaction.custom.Adyen_pspReference}&txType=Payment'>
<isprint value="${paymentInstrument.paymentTransaction.custom.Adyen_pspReference}">
</A>
</td>
</tr>
<tr>
<td class='infobox_title'>Payment Method</td>
<td class='infobox_item'><isprint value="${paymentInstrument.custom.adyenPaymentMethod}"></td>
</tr>
</isif>
</isloop>
| var urlPrefixType : String = 'test'; | ||
| if (mode == 'LIVE') { | ||
| urlPrefixType = 'live'; | ||
| } |



Show both PSP reference links for partial payment orders
Summary
For partial payment orders, the PSP reference used for links in Business Manager was resolved from the order level, resulting in only the last transaction’s PSP reference being displayed and linked.
This change updates the PSP reference resolution to be transaction-based, so each payment transaction exposes its own PSP reference. This ensures correct linking for all payment instruments involved in a partial payment order.

Tested scenarios
Fixed issue: