Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix migration for payments without the currency
Pacu269e35b272d50
diff --git a/saleor/payment/__init__.py b/saleor/payment/__init__.pyindex af79e0c062..1db12fb3f8 100644--- a/saleor/payment/__init__.py+++ b/saleor/payment/__init__.py@@ -26,8 +26,8 @@ class TransactionType:VOID = 'void'REFUND = 'refund'# FIXME we could use another status like WAITING_FOR_AUTH for transactions- # Which were authorized, ubt needs to be confirmed manually by staff- # eg. Braintree with submit_for_settlement's enabled+ # Which were authorized, but needs to be confirmed manually by staff+ # eg. Braintree with "submit_for_settlement" enabledCHOICES = [(AUTH, pgettext_lazy('transaction type', 'Authorization')),(CHARGE, pgettext_lazy('transaction type', 'Charge')),(REFUND, pgettext_lazy('transaction type', 'Refund')),diff --git a/saleor/payment/migrations/0002_transfer_payment_to_payment_method.py b/saleor/payment/migrations/0002_transfer_payment_to_payment_method.pyindex 1688c2f942..2925f46131 100644--- a/saleor/payment/migrations/0002_transfer_payment_to_payment_method.py+++ b/saleor/payment/migrations/0002_transfer_payment_to_payment_method.py@@ -1,6 +1,7 @@# Generated by Django 2.1.2 on 2018-10-17 19:42from django.db import migrationsfrom prices import Money+from django.conf import settingsfrom .. import ChargeStatus, TransactionTypefrom ..models import Transaction@@ -90,7 +91,8 @@ def transfer_payments_to_payment_methods(apps, schema_editor):'delivery_fee': pay.delivery,'message': pay.message,'description': pay.description,- 'extra_data': pay.extra_data}+ 'extra_data': pay.extra_data,+ 'tax': pay.tax}payment_method = PaymentMethod.objects.create(order=pay.order,variant=pay.variant,@@ -107,8 +109,8 @@ def transfer_payments_to_payment_methods(apps, schema_editor):customer_ip_address=pay.customer_ip_address,extra_data=extra_data,token=pay.token,- captured_amount=Money(pay.captured_amount, pay.currency),- total=Money(pay.total, pay.currency),+ captured_amount=Money(pay.captured_amount, pay.currency or settings.DEFAULT_CURRENCY),+ total=Money(pay.total, pay.currency or settings.DEFAULT_CURRENCY),is_active=get_is_active(pay.status, pay),charge_status=get_charge_status(pay))create_transactions(payment_method, pay)