solidusio-contrib / solidus_importer

Solidus importer extension to migrate data from other eCommerce systems
BSD 3-Clause "New" or "Revised" License
15 stars 30 forks source link

Order importer does not create payments for shipping cost #86

Open johnpitchko opened 2 years ago

johnpitchko commented 2 years ago

Hi @kennyadsl @aldesantis, Bryan asked me to mention this to you. We noticed a potential bug in the order importer where it does not generate payment records to account for shipment costs. The result was imported orders were left in a balance_due payment state.

You'll see in the attached screenshot, after the import of the template, there are only payment records for the line items.

image

I wrote a patch for our needs but am happy to contribute it upstream.

kennyadsl commented 2 years ago

Thanks! Of course if you can contribute that would be awesome. What was the root cause of the issue?

johnpitchko commented 2 years ago

I'm definitely no expert on the importer, so I might have some pieces wrong. But when a line item is imported, a payment is created via payment_attributes, which only takes into account the amount of the line item without shipping. The shipping cost is not included in this value.

So what I kludged together a decorator for the after_import method to look up any orders that were imported that are in balance_due payment state, then create an additional payment for the shipping cost.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.