Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Merge branch 'master' into infer-transaction-kind-from-operation

jxltom24e72458ffd9
diff --cc CHANGELOG.md
index c002ad8a09,6eca51541a..5eab9c29f0
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -33,4 -33,8 +33,9 @@@ All notable, unreleased changes to thi
- Add ShopFetchTaxRates mutation - #3622 by @fowczarek
- Add taxes section - #3622 by @dominik-zeglen
- Expose in API list of supported payment gateways - #3639 by @fowczarek
+ - Display payment status in account order list page and account order detail page - #3637 by @jxltom
+ - Fix bug where node order is not preserved in GraphQL API - #3632 by @jxltom
+ - Support set arbitary charge status for dummy gateway in storefront 1.0 - #3648 by @jxltom
+ - Fix typo in the definition of order UNFULFILLED status - #3649 by @jxltom
+ - Add missing margin for order notes section - #3650 by @jxltom
+- Infer default transaction kind from operation type instead of passing it manually - #3646 by @jxltom
diff --cc saleor/payment/utils.py
index 9f0913352e,ee75a01e05..b2b810cacb
--- a/saleor/payment/utils.py
+++ b/saleor/payment/utils.py
@@@ -293,15 -305,10 +318,9 @@@ def gateway_process_payment
"""Performs whole payment process on a gateway."""
transaction = call_gateway(
operation_type=OperationType.PROCESS_PAYMENT,
- transaction_kind=TransactionKind.CAPTURE,
payment=payment, payment_token=payment_token, amount=payment.total)
- payment.charge_status = ChargeStatus.CHARGED
- payment.captured_amount += transaction.amount
- payment.save(update_fields=['charge_status', 'captured_amount'])
- order = payment.order
- if order and order.is_fully_paid():
- handle_fully_paid_order(order)
-
+ _gateway_postprocess(transaction, payment)
return transaction
@@@ -324,15 -331,10 +343,9 @@@ def gateway_charge
transaction = call_gateway(
operation_type=OperationType.CHARGE,
- transaction_kind=TransactionKind.CHARGE,
payment=payment, payment_token=payment_token, amount=amount)
- payment.charge_status = ChargeStatus.CHARGED
- payment.captured_amount += transaction.amount
- payment.save(update_fields=['charge_status', 'captured_amount'])
- order = payment.order
- if order and order.is_fully_paid():
- handle_fully_paid_order(order)
-
+ _gateway_postprocess(transaction, payment)
return transaction
@@@ -365,15 -368,10 +378,9 @@@ def gateway_capture(payment: Payment, a
transaction = call_gateway(
operation_type=OperationType.CAPTURE,
- transaction_kind=TransactionKind.CAPTURE,
payment=payment, payment_token=payment_token, amount=amount)
- payment.charge_status = ChargeStatus.CHARGED
- payment.captured_amount += transaction.amount
- payment.save(update_fields=['charge_status', 'captured_amount'])
- order = payment.order
- if order and order.is_fully_paid():
- handle_fully_paid_order(order)
-
+ _gateway_postprocess(transaction, payment)
return transaction
@@@ -390,11 -388,10 +397,9 @@@ def gateway_void(payment) -> Transactio
transaction = call_gateway(
operation_type=OperationType.VOID,
- transaction_kind=TransactionKind.VOID,
payment=payment, payment_token=payment_token)
- payment.is_active = False
- payment.save(update_fields=['is_active'])
-
+ _gateway_postprocess(transaction, payment)
return transaction
@@@ -424,14 -421,8 +429,7 @@@ def gateway_refund(payment, amount: Dec
transaction = call_gateway(
operation_type=OperationType.REFUND,
- transaction_kind=TransactionKind.REFUND,
payment=payment, payment_token=payment_token, amount=amount)
- changed_fields = ['captured_amount']
- payment.captured_amount -= transaction.amount
- if not payment.captured_amount:
- payment.charge_status = ChargeStatus.FULLY_REFUNDED
- payment.is_active = False
- changed_fields += ['charge_status', 'is_active']
- payment.save(update_fields=changed_fields)
-
+ _gateway_postprocess(transaction, payment)
return transaction