Skip to content

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

Merge remote-tracking branch 'upstream/master' into fully-charged-and-partially-refund

Unknown372232b0a8e2
diff --cc CHANGELOG.md
index b8f722e0aa,6a139fea3c..da31022efd
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -22,9 -23,32 +23,33 @@@ All notable, unreleased changes to thi
- Add orderByToken query - #3740 by @michaljelonek
- Enable existing search with backend picker in products query - #3736 by @michaljelonek
- Fix bug where payment is not filtered from active ones when creating payment - #3731 by @jxltom
+ - Sort order's payment and history descendingly - #3747 by @jxltom
+ - Use exact image versions in docker-compose - #3742 by @ashishnitinpatil
+ - Add mutation to connect voucher with checkout - #3739 by @Kwaidan00
+ - Update S3 deployment documentation to include CORS configuration note - #3743 by @NyanKiyoshi
+ - Fix missing migrations for is_published field of product and page model - #3757 by @jxltom
+ - Add header and footer for checkout success pages #3752 by @jxltom
+ - Filter order by payment status from order's last payment - #3749 @jxltom
+ - Reuse cart creation logic in API - #3761 by @maarcingebala
+ - Add json fields to models for content/description - #3756 by @michaljelonek
+ - Fix bug where errors are not returned when creating fulfillment with non-existed order line - #3777 by @jxltom
+ - Support fulfill order with 0 quantity only if total quantity is larger than 0 - #3754 by @jxltom
+ - Fix storefront styles after bootstrap is updated to 4.3.1 - #3753 by @jxltom
+ - Fix logo size in different browser and devices with different sizes - #3722 by @jxltom
+ - Add missing type definition for dashboard 2.0 - #3776 by @jxltom
+ - Add mutations to manage addresses for authenticated customers - #3772 by @Kwaidan00, @maarcingebala
+ - Only include cancelled fulfillments for staff in fulfillment API - #3778 by @jxltom
+ - Fix incorrect cart badge location - #3786 by @jxltom
+ - Add function to recalculate order's total weight - #3755 by @Kwaidan00, @maarcingebala
+ - Unify behavior after creating checkout in API and Storefront 1.0; code formatting improvements - #3790 by @maarcingebala
+- Support partially charged and partially refunded payment status - #3735 by @jxltom
+ ## 2.3.1
+ - Fix access to private variant fields in API - #3773 by maarcingebala
+ - Limit access of quantity and allocated quantity to staff in GraphQL API #3780 by @jxltom
+
+
## 2.3.0
### API
- Return user's last checkout in the `User` type - #3578 by @fowczarek
diff --cc saleor/payment/__init__.py
index bc74f7c383,4efa6297c7..99a34432a0
--- a/saleor/payment/__init__.py
+++ b/saleor/payment/__init__.py
@@@ -73,28 -77,21 +77,31 @@@ class TransactionKind
class ChargeStatus:
+ """Represents possible statuses of a payment.
+
+ The following statuses are possible:
- - CHARGED - funds were taken off the customer founding source,
- partly or completely covering the payment amount.
+ - NOT_CHARGED - no funds were take off the customer founding source yet.
++ - PARTIALLY_CHARGED - funds were taken off the customer's funding source,
++ partly covering the payment amount.
++ - FULLY_CHARGED - funds were taken off the customer founding source,
++ partly or completely covering the payment amount.
++ - PARTIALLY_REFUNDED - part of charged funds were returned to the customer.
+ - FULLY_REFUNDED - all charged funds were returned to the customer.
"""
- - Not charged: No funds were take off the customer's funding source yet.
- - Partially charged: Funds were taken off the customer's funding source,
- partly covering the payment amount.
- - Fully charged: Funds were taken off the customer's funding source,
- completely covering the payment amount.
- - Partially refunded: Part of charged funds were returned to the customer.
- - Fully refunded: All charged funds were returned to the customer.
- """
+
- CHARGED = 'charged'
NOT_CHARGED = 'not-charged'
+ PARTIALLY_CHARGED = 'partially-charged'
+ FULLY_CHARGED = 'fully-charged'
+ PARTIALLY_REFUNDED = 'partially-refunded'
FULLY_REFUNDED = 'fully-refunded'
+
CHOICES = [
- (CHARGED, pgettext_lazy('payment status', 'Charged')),
(NOT_CHARGED, pgettext_lazy('payment status', 'Not charged')),
+ (PARTIALLY_CHARGED, pgettext_lazy(
+ 'payment status', 'Partially charged')),
+ (FULLY_CHARGED, pgettext_lazy('payment status', 'Fully charged')),
+ (PARTIALLY_REFUNDED, pgettext_lazy(
+ 'payment status', 'Partially refunded')),
(FULLY_REFUNDED, pgettext_lazy('payment status', 'Fully refunded'))]
diff --cc saleor/payment/models.py
index 2f88303776,beb6f00627..59f09c07ec
--- a/saleor/payment/models.py
+++ b/saleor/payment/models.py
@@@ -24,40 -26,18 +26,18 @@@ class Payment(models.Model)
at the gateway level, we are operating on the reusable token
which is a unique identifier of the customer for given gateway.
- Several payment methods can be used within a single order.
+ Several payment methods can be used within a single order. Each payment
+ method may consist of multiple transactions.
"""
- # FIXME we should provide an option to store the card for later usage
- # FIXME probably we should have pending status for 3d secure
+
gateway = models.CharField(max_length=255)
is_active = models.BooleanField(default=True)
- #: Creation date and time
created = models.DateTimeField(auto_now_add=True)
- #: Date and time of last modification
modified = models.DateTimeField(auto_now=True)
charge_status = models.CharField(
- max_length=20,
- choices=ChargeStatus.CHOICES,
- max_length=15, choices=ChargeStatus.CHOICES,
++ max_length=20, choices=ChargeStatus.CHOICES,
default=ChargeStatus.NOT_CHARGED)
-
- billing_first_name = models.CharField(max_length=256, blank=True)
- billing_last_name = models.CharField(max_length=256, blank=True)
- billing_company_name = models.CharField(max_length=256, blank=True)
- billing_address_1 = models.CharField(max_length=256, blank=True)
- billing_address_2 = models.CharField(max_length=256, blank=True)
- billing_city = models.CharField(max_length=256, blank=True)
- billing_city_area = models.CharField(max_length=128, blank=True)
- billing_postal_code = models.CharField(max_length=256, blank=True)
- billing_country_code = models.CharField(max_length=2, blank=True)
- billing_country_area = models.CharField(max_length=256, blank=True)
- billing_email = models.EmailField(blank=True)
- customer_ip_address = models.GenericIPAddressField(blank=True, null=True)
- extra_data = models.TextField(blank=True, default='')
token = models.CharField(max_length=128, blank=True, default='')
-
- #: Currency code (might be gateway-specific)
- # FIXME: add ISO4217 validator?
- currency = models.CharField(max_length=10)
- #: Total amount (gross)
total = models.DecimalField(
max_digits=settings.DEFAULT_MAX_DIGITS,
decimal_places=settings.DEFAULT_DECIMAL_PLACES,