Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update code after code review
Mateusz Grzyb7c3c6b5c0045
diff --git a/saleor/payment/gateways/np_atobarai/api_helpers.py b/saleor/payment/gateways/np_atobarai/api_helpers.pyindex 18cf5b9910..3bcdf0d447 100644--- a/saleor/payment/gateways/np_atobarai/api_helpers.py+++ b/saleor/payment/gateways/np_atobarai/api_helpers.py@@ -189,7 +189,7 @@ def get_goods_with_refunds(refunded_lines = create_refunded_lines(order, refund_data)- subtotal = Decimal("0.00")+ total = Decimal("0.00")for line in payment_information.lines_data.lines:quantity = line.quantityrefunded_quantity = refunded_lines.get(line.variant_id)@@ -206,15 +206,15 @@ def get_goods_with_refunds("quantity": quantity,})- subtotal += line.amount * quantity+ total += line.amount * quantitygoods_lines.extend(_get_voucher_and_shipping_goods(config, payment_information))- subtotal += payment_information.lines_data.shipping_amount- subtotal += payment_information.lines_data.voucher_amount+ total += payment_information.lines_data.shipping_amount+ total += payment_information.lines_data.voucher_amount- total = payment.captured_amount - payment_information.amount-- refunded_manual_amount = total - subtotal+ billed_amount = payment.captured_amount - payment_information.amount+ # NP requires that the sum of all goods prices is equal to billing amount+ refunded_manual_amount = billed_amount - totalif refunded_manual_amount:goods_lines.append(@@ -227,7 +227,7 @@ def get_goods_with_refunds(})- return goods_lines, total+ return goods_lines, billed_amountdef get_goods(config: "ApiConfig", payment_information: PaymentData) -> List[dict]: