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

function getPaymentInfoFromOrder from order-placed/react/utils/index.ts considers only the first payment of the payments array. #711

Open
gaboulsvtex opened this issue Dec 16, 2024 · 0 comments
Labels
question Further information is requested

Comments

@gaboulsvtex
Copy link

What are you trying to accomplish? Please describe.
I have a question/enhancement regarding the getPaymentInfoFromOrder declared at order-placed/react/utils/index.ts:
https://github.com/vtex-apps/order-placed/blob/3eb63c87564c1e33447c3e60348c5baeb4435f5f/react/utils/index.ts#L61
image

From my understanding:
It defines base = 'paymentData.transactions[0].payments[0]', and it does not iterate along the transactions nor payments array, considering solely the first payment from the first transaction, each time this function is called.

Moreover, at order-placed/react/Notices.tsx, the way the const bankInvoice is declared, it gathers all the orders, and for each order, it calls the getPaymentInfoFromOrder function (which assumes the Bank Invoice payment is in the position transactions[0].payments[0]), then it calls a find to find one of these orders in which the first payment method from the payments array is a Bank Invoice.
https://github.com/vtex-apps/order-placed/blob/master/react/Notices.tsx#L26
image

What if the Bank Invoice payment is in the second position of the payments array?
What if the Bank Invoice payment is in the second transaction of an order?

What have you tried so far?
I have not tried anything, I'm just wondering.

Additional info
Example of a test order in which the bank invoice is at the second position of the payments array, in the first transaction:
https://fastshopbrqa2.vtexcommercestable.com.br/api/oms/pvt/orders/1483250737638-01
https://fastshopbrqa2.myvtex.com/checkout/orderPlaced/?og=1483250737638
image

In this case, the Bank Invoice information wasn't displayed at the Order Placed page, since the getPaymentInfoFromOrder didn't consider it.

Account Workspace
fastshopbrqa2 master
@gaboulsvtex gaboulsvtex added the question Further information is requested label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant