-
Notifications
You must be signed in to change notification settings - Fork 86
Business Manager Orders: PSP reference linking for partial payment orders #1444
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,11 @@ | |
| var adyenAction = JSON.parse(paymentInstrument.custom.adyenAction); | ||
| var adyenPaymentMethod = paymentInstrument.custom.adyenPaymentMethod; | ||
| } | ||
| var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); | ||
| var urlPrefixType : String = 'test'; | ||
| if (mode == 'LIVE') { | ||
| urlPrefixType = 'live'; | ||
| } | ||
| </isscript> | ||
| <BR><BR> | ||
|
|
||
|
|
@@ -26,22 +31,32 @@ | |
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr> | ||
| <td class='infobox_title'>PSP reference</td> | ||
| <td class='infobox_item'> | ||
| <isscript> | ||
| var mode : String = dw.system.Site.getCurrent().getCustomPreferenceValue("Adyen_Mode"); | ||
| var urlPrefixType : String = 'test'; | ||
| if (mode == 'LIVE') { | ||
| urlPrefixType = 'live'; | ||
| } | ||
| </isscript> | ||
| <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 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> | ||
|
|
||
|
Comment on lines
+34
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic to handle single and multiple payment instruments can be greatly simplified. The current implementation has a few issues:
A single loop over all payment instruments can handle all cases (0, 1, or many) correctly and consistently. This removes the need for the |
||
| <tr><td class='infobox_title'>Eventcode</td><td class='infobox_item'><isprint value="${order.custom.Adyen_eventCode}"></td></tr> | ||
| <isif condition="${adyenAdditionalPaymentData != null}"> | ||
| <isloop items="${adyenAdditionalPaymentData}" var="additionalItem" status="loopstate"> | ||
|
|
||
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.
For conciseness and better readability, you can use a ternary operator to assign the value to
urlPrefixType.