details:   https://code.tryton.org/tryton/commit/71a90e1080d3
branch:    8.2
user:      Cédric Krier <[email protected]>
date:      Wed Nov 18 15:29:55 2026 +0100
description:
        Ignore children transaction with non successful parent when updating 
Shopify transaction

        Closes #15246
        (grafted from 90fa66afe5107d2f7ba0fe0842bbc716df94ad0c)
diffstat:

 modules/web_shop_shopify/account.py |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r fe24f93d0fc8 -r 71a90e1080d3 modules/web_shop_shopify/account.py
--- a/modules/web_shop_shopify/account.py       Thu Nov 12 13:51:33 2026 +0100
+++ b/modules/web_shop_shopify/account.py       Wed Nov 18 15:29:55 2026 +0100
@@ -112,22 +112,34 @@
                 captured[payment] += Decimal(
                     transaction['amountSet']['presentmentMoney']['amount'])
             elif transaction['kind'] == 'CAPTURE':
-                payment = id2payments[
-                    gid2id(transaction['parentTransaction']['id'])]
+                try:
+                    payment = id2payments[
+                        gid2id(transaction['parentTransaction']['id'])]
+                except KeyError:
+                    # the parent transaction was not successful
+                    continue
                 id2payments[gid2id(transaction['id'])] = payment
                 captured[payment] += Decimal(
                     transaction['amountSet']['presentmentMoney']['amount'])
             elif transaction['kind'] == 'VOID':
-                payment = id2payments[
-                    gid2id(transaction['parentTransaction']['id'])]
+                try:
+                    payment = id2payments[
+                        gid2id(transaction['parentTransaction']['id'])]
+                except KeyError:
+                    # the parent transaction was not successful
+                    continue
                 voided[payment] += Decimal(
                     transaction['amountSet']['presentmentMoney']['amount'])
             elif transaction['kind'] == 'REFUND':
                 if not transaction['parentTransaction']:
                     payment = id2payments[gid2id(transaction['id'])]
                 else:
-                    payment = id2payments[
-                        gid2id(transaction['parentTransaction']['id'])]
+                    try:
+                        payment = id2payments[
+                            gid2id(transaction['parentTransaction']['id'])]
+                    except KeyError:
+                        # the parent transaction was not successful
+                        continue
                     captured[payment] -= Decimal(
                         transaction['amountSet']['presentmentMoney']['amount'])
                 refunded[payment] += Decimal(

Reply via email to