Skip to content
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

Passing paypal line items #1069

Merged
merged 5 commits into from
Apr 22, 2024
Merged

Conversation

shanikantsingh
Copy link
Member

Summary

Describe the changes proposed in this pull request:

  • What is the motivation for this change?
  • add lineItems for Paypal
  • What existing problem does this pull request solve?
  • add lineItems for Paypal

Tested scenarios

Description of tested scenarios:

Fixed issue: #SFI-541

@zenit2001 zenit2001 changed the base branch from main to feature/SFI-544-separate-cartridges April 19, 2024 11:06
@shanikantsingh shanikantsingh changed the base branch from feature/SFI-544-separate-cartridges to develop April 19, 2024 11:07
function getLineItems({ Order: order, Basket: basket }) {
if (!(order || basket)) return null;
const orderOrBasket = order || basket;
const allLineItems = orderOrBasket.getProductLineItems();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to pass shipping/promotions as line items? Similar we do for klarna and other open invoice methods?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we utilize and rename the current adyenOpenInvoiceData.js file for passing line items also to PayPal? This way we will not have duplicated code

We can possibly do something like function getLineItems({ Order: order, Basket: basket, addTaxPercentage, includeProperties = ['amountExcludingTax', 'taxAmount', ........... }), and conditionally pass the line items in adyenCheckout.js

@@ -143,6 +144,11 @@ function createPaymentRequest(args) {
}
}

//add line items for paypal
if (paymentRequest.paymentMethod.type.indexOf('paypal') > -1) {
paymentRequest.lineItems = paypalHelper.getLineItems(args);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to use adyenGetOpenInvoiceData.js then we can pass the line items here as follows:
args.includeProperties = ['amountExcludingTax', 'taxAmount', ......];
paymentRequest.lineItems = AdyenGetOpenInvoiceData.getLineItems(args);

@zenit2001 zenit2001 added the new New Feature label Apr 22, 2024
@shanikantsingh shanikantsingh force-pushed the feature/SFI-541_paypal_lineitems branch from 5995172 to 4edc344 Compare April 22, 2024 10:46
Copy link

sonarcloud bot commented Apr 22, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
5.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@zenit2001 zenit2001 changed the title Feature/sfi 541 paypal lineitems Passing paypal line items Apr 22, 2024
@shanikantsingh shanikantsingh merged commit 0e5fbec into develop Apr 22, 2024
14 of 15 checks passed
@shanikantsingh shanikantsingh deleted the feature/SFI-541_paypal_lineitems branch April 22, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants