Skip to content

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

Fixes after rebase with latest master

Pacu2a6c6da0945bd
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 5fa5ee6c65..45737991d1 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -75,9 +75,9 @@ class Query(ProductQueries):
checkout = graphene.Field(
Checkout, description='Single checkout.',
token=graphene.Argument(graphene.UUID))
- checkouts = DjangoFilterConnectionField(
+ checkouts = PrefetchingConnectionField(
Checkout, description='List of checkouts.')
- checkout_lines = DjangoFilterConnectionField(
+ checkout_lines = PrefetchingConnectionField(
CheckoutLine, description='List of checkout lines')
checkout_line = graphene.Field(
CheckoutLine, id=graphene.Argument(graphene.ID),
@@ -125,7 +125,7 @@ class Query(ProductQueries):
payment = graphene.Field(Payment, id=graphene.Argument(graphene.ID))
payment_transaction_token = graphene.Field(
graphene.String, args={'gateway': PaymentGatewayEnum()})
- payments = DjangoFilterConnectionField(
+ payments = PrefetchingConnectionField(
Payment,
description='List of payments')
sale = graphene.Field(
diff --git a/saleor/graphql/order/resolvers.py b/saleor/graphql/order/resolvers.py
index ac63ed8b36..41b03637fd 100644
--- a/saleor/graphql/order/resolvers.py
+++ b/saleor/graphql/order/resolvers.py
@@ -1,12 +1,12 @@
import graphene
import graphene_django_optimizer as gql_optimizer
-from ...order import models, OrderStatus, OrderEvents
+from ...order import OrderEvents, OrderStatus, models
from ...order.utils import sum_order_totals
-from ..utils import filter_by_query_param, filter_by_period
+from ...shipping import models as shipping_models
+from ..utils import filter_by_period, filter_by_query_param
from .types import Order, OrderStatusFilter
-
ORDER_SEARCH_FIELDS = (
'id', 'discount_name', 'token', 'user_email', 'user__email')
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 7f7037a6a8..0c010dbd2b 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -4,7 +4,6 @@ from graphene import relay
from ...order import OrderEvents, OrderEventsEmails, models
from ...product.templatetags.product_images import get_thumbnail
-from ...shipping import models as shipping_models
from ..account.types import User
from ..core.fields import PrefetchingConnectionField
from ..core.types.common import CountableDjangoObjectType
@@ -198,7 +197,7 @@ class Order(CountableDjangoObjectType):
OrderEvent,
description='List of events associated with the order.'),
model_field='events')
- balance_amount = graphene.Field(
+ total_balance = graphene.Field(
Money,
description='''The difference between the paid and the order total
amount.''', required=True)
@@ -206,6 +205,9 @@ class Order(CountableDjangoObjectType):
required=False, description='Email address of the customer.')
is_shipping_required = graphene.Boolean(
description='Returns True, if order requires shipping.')
+ lines = graphene.List(
+ OrderLine, required=True,
+ description='List of order lines for the order')
class Meta:
description = 'Represents an order in the shop.'
@@ -255,10 +257,10 @@ class Order(CountableDjangoObjectType):
payment = obj.get_last_payment()
if payment:
return payment.captured_amount
- @staticmethod
- def resolve_balance_amount(obj, info):
- return obj.balance_amount
+ @staticmethod
+ def resolve_total_balance(obj, info):
+ return obj.total_balance
@staticmethod
def resolve_fulfillments(obj, info):
@@ -309,9 +311,5 @@ class Order(CountableDjangoObjectType):
return resolve_shipping_methods(
obj, info, obj.get_subtotal().gross.amount)
- @staticmethod
- def resolve_lines(obj, info):
- return obj.lines.all()
-
def resolve_is_shipping_required(self, info):
return self.is_shipping_required()
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index a6a1eeee21..cdd7d5836b 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -958,7 +958,7 @@ type Order implements Node {
displayGrossPrices: Boolean!
customerNote: String!
weight: Weight
- lines: [OrderLine]!
+ lines(before: String, after: String, first: Int, last: Int): OrderLineCountableConnection
fulfillments: [Fulfillment]!
events: [OrderEvent]
payments(before: String, after: String, first: Int, last: Int, id: ID): PaymentCountableConnection
@@ -970,9 +970,9 @@ type Order implements Node {
paymentStatusDisplay: String
subtotal: TaxedMoney
statusDisplay: String
- authorizedAmount: Money!
- balanceAmount: Money!
- capturedAmount: Money!
+ totalAuthorized: Money
+ totalCaptured: Money
+ totalBalance: Money!
isShippingRequired: Boolean
}
@@ -1575,8 +1575,8 @@ type Query {
reportProductSales(period: ReportingPeriod!, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection
addressValidator(input: AddressValidationInput!): AddressValidationData
checkout(token: UUID): Checkout
- checkouts(before: String, after: String, first: Int, last: Int, token: UUID): CheckoutCountableConnection
- checkoutLines(before: String, after: String, first: Int, last: Int, id: ID): CheckoutLineCountableConnection
+ checkouts(before: String, after: String, first: Int, last: Int): CheckoutCountableConnection
+ checkoutLines(before: String, after: String, first: Int, last: Int): CheckoutLineCountableConnection
checkoutLine(id: ID): CheckoutLine
menu(id: ID, name: String): Menu
menus(query: String, before: String, after: String, first: Int, last: Int): MenuCountableConnection
@@ -1587,12 +1587,12 @@ type Query {
orders(query: String, created: ReportingPeriod, status: OrderStatusFilter, before: String, after: String, first: Int, last: Int): OrderCountableConnection
homepageEvents(before: String, after: String, first: Int, last: Int): OrderEventCountableConnection
page(id: ID, slug: String): Page
- pages(query: String, before: String, after: String, first: Int, last: Int, id: ID, title: String): PageCountableConnection
+ pages(query: String, before: String, after: String, first: Int, last: Int): PageCountableConnection
payment(id: ID): Payment
paymentTransactionToken(gateway: ProvidersEnum): String
- payments(before: String, after: String, first: Int, last: Int, id: ID): PaymentCountableConnection
- sale(id: ID): Sale
- sales(query: String, before: String, after: String, first: Int, last: Int, name_Icontains: String, type_Icontains: String, value_Gte: Float, value_Lte: Float, startDate: Date, endDate: Date): SaleCountableConnection
+ payments(before: String, after: String, first: Int, last: Int): PaymentCountableConnection
+ sale(id: ID!): Sale
+ sales(query: String, before: String, after: String, first: Int, last: Int): SaleCountableConnection
shop: Shop
voucher(id: ID!): Voucher
vouchers(query: String, before: String, after: String, first: Int, last: Int): VoucherCountableConnection
diff --git a/saleor/order/models.py b/saleor/order/models.py
index be5ef3f5a8..4a358811a1 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -256,7 +256,7 @@ class Order(models.Model):
return zero_money()
@property
- def balance_amount(self):
+ def total_balance(self):
return self.captured_amount - self.total.gross
def get_total_weight(self):
diff --git a/saleor/payment/providers/braintree/__init__.py b/saleor/payment/providers/braintree/__init__.py
index 362b532cdb..602d705440 100644
--- a/saleor/payment/providers/braintree/__init__.py
+++ b/saleor/payment/providers/braintree/__init__.py
@@ -64,7 +64,7 @@ def get_error_for_client(errors: List) -> str:
'Unable to process transaction. Please try again in a moment')
for error in errors:
if error['code'] in ERROR_CODES_WHITELIST:
- return ERROR_CODES_WHITELIST[error['code'] or error['message']
+ return ERROR_CODES_WHITELIST[error['code']] or error['message']
return default_msg
diff --git a/saleor/static/dashboard-next/gql-types.ts b/saleor/static/dashboard-next/gql-types.ts
index 55057b8c5e..72331852f8 100644
--- a/saleor/static/dashboard-next/gql-types.ts
+++ b/saleor/static/dashboard-next/gql-types.ts
@@ -727,14 +727,14 @@ export interface OrderCancelMutation {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
@@ -920,14 +920,14 @@ export interface OrderRefundMutation {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
@@ -1103,14 +1103,14 @@ export interface OrderVoidMutation {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
@@ -1296,14 +1296,14 @@ export interface OrderCaptureMutation {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
@@ -1544,14 +1544,14 @@ export interface OrderDetailsQuery {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
@@ -3729,14 +3729,14 @@ export interface OrderDetailsFragment {
};
} | null;
// Amount authorized for the order.
- authorizedAmount: {
+ totalAuthorized: {
// Amount of money.
amount: number;
// Currency code.
currency: string;
} | null;
// Amount captured by payment.
- capturedAmount: {
+ totalCaptured: {
// Amount of money.
amount: number;
// Currency code.
diff --git a/saleor/static/dashboard-next/orders/fixtures.ts b/saleor/static/dashboard-next/orders/fixtures.ts
index cb9fc5193a..68786ff6a9 100644
--- a/saleor/static/dashboard-next/orders/fixtures.ts
+++ b/saleor/static/dashboard-next/orders/fixtures.ts
@@ -744,7 +744,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
OrderAction.REFUND,
OrderAction.VOID
],
- authorizedAmount: {
+ totalAuthorized: {
__typename: "Money",
amount: 234.93,
currency: "USD"
@@ -800,7 +800,7 @@ export const order = (placeholder: string): OrderDetails_order => ({
streetAddress1: "487 Roberto Shores",
streetAddress2: ""
},
- capturedAmount: {
+ totalCaptured: {
__typename: "Money",
amount: 0,
currency: "USD"
@@ -1014,10 +1014,10 @@ export const order = (placeholder: string): OrderDetails_order => ({
});
export const draftOrder = (placeholder: string) => ({
__typename: "Order" as "Order",
- authorizedAmount: null,
+ totalAuthorized: null,
availableShippingMethods: null,
billingAddress: null,
- capturedAmount: null,
+ totalCaptured: null,
created: "2018-09-20T23:23:39.811428+00:00",
events: [],
fulfillments: [],
diff --git a/saleor/static/dashboard-next/orders/queries.ts b/saleor/static/dashboard-next/orders/queries.ts
index 7058bfc2b2..eadd3262d2 100644
--- a/saleor/static/dashboard-next/orders/queries.ts
+++ b/saleor/static/dashboard-next/orders/queries.ts
@@ -131,11 +131,11 @@ export const fragmentOrderDetails = gql`
}
}
actions
- authorizedAmount {
+ totalAuthorized {
amount
currency
}
- capturedAmount {
+ totalCaptured {
amount
currency
}
diff --git a/saleor/static/dashboard-next/orders/types/OrderCancel.ts b/saleor/static/dashboard-next/orders/types/OrderCancel.ts
index a0fb083b99..8fab87da4c 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCancel.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCancel.ts
@@ -198,13 +198,13 @@ export interface OrderCancel_orderCancel_order_total {
tax: OrderCancel_orderCancel_order_total_tax;
}
-export interface OrderCancel_orderCancel_order_authorizedAmount {
+export interface OrderCancel_orderCancel_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderCancel_orderCancel_order_capturedAmount {
+export interface OrderCancel_orderCancel_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -247,8 +247,8 @@ export interface OrderCancel_orderCancel_order {
subtotal: OrderCancel_orderCancel_order_subtotal | null;
total: OrderCancel_orderCancel_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderCancel_orderCancel_order_authorizedAmount;
- capturedAmount: OrderCancel_orderCancel_order_capturedAmount;
+ totalAuthorized: OrderCancel_orderCancel_order_totalAuthorized;
+ totalCaptured: OrderCancel_orderCancel_order_totalCaptured;
user: OrderCancel_orderCancel_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderCancel_orderCancel_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderCapture.ts b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
index 0cd4053bf3..358c77652d 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCapture.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
@@ -204,13 +204,13 @@ export interface OrderCapture_orderCapture_order_total {
tax: OrderCapture_orderCapture_order_total_tax;
}
-export interface OrderCapture_orderCapture_order_authorizedAmount {
+export interface OrderCapture_orderCapture_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderCapture_orderCapture_order_capturedAmount {
+export interface OrderCapture_orderCapture_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderCapture_orderCapture_order {
subtotal: OrderCapture_orderCapture_order_subtotal | null;
total: OrderCapture_orderCapture_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderCapture_orderCapture_order_authorizedAmount;
- capturedAmount: OrderCapture_orderCapture_order_capturedAmount;
+ totalAuthorized: OrderCapture_orderCapture_order_totalAuthorized;
+ totalCaptured: OrderCapture_orderCapture_order_totalCaptured;
user: OrderCapture_orderCapture_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderCapture_orderCapture_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
index dc8dde84d5..27b13cd035 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCreateFulfillment.ts
@@ -204,13 +204,13 @@ export interface OrderCreateFulfillment_orderFulfillmentCreate_order_total {
tax: OrderCreateFulfillment_orderFulfillmentCreate_order_total_tax;
}
-export interface OrderCreateFulfillment_orderFulfillmentCreate_order_authorizedAmount {
+export interface OrderCreateFulfillment_orderFulfillmentCreate_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderCreateFulfillment_orderFulfillmentCreate_order_capturedAmount {
+export interface OrderCreateFulfillment_orderFulfillmentCreate_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderCreateFulfillment_orderFulfillmentCreate_order {
subtotal: OrderCreateFulfillment_orderFulfillmentCreate_order_subtotal | null;
total: OrderCreateFulfillment_orderFulfillmentCreate_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderCreateFulfillment_orderFulfillmentCreate_order_authorizedAmount;
- capturedAmount: OrderCreateFulfillment_orderFulfillmentCreate_order_capturedAmount;
+ totalAuthorized: OrderCreateFulfillment_orderFulfillmentCreate_order_totalAuthorized;
+ totalCaptured: OrderCreateFulfillment_orderFulfillmentCreate_order_totalCaptured;
user: OrderCreateFulfillment_orderFulfillmentCreate_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderCreateFulfillment_orderFulfillmentCreate_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDetails.ts b/saleor/static/dashboard-next/orders/types/OrderDetails.ts
index 5566010389..047b108e65 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDetails.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDetails.ts
@@ -198,13 +198,13 @@ export interface OrderDetails_order_total {
tax: OrderDetails_order_total_tax;
}
-export interface OrderDetails_order_authorizedAmount {
+export interface OrderDetails_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderDetails_order_capturedAmount {
+export interface OrderDetails_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -247,8 +247,8 @@ export interface OrderDetails_order {
subtotal: OrderDetails_order_subtotal | null;
total: OrderDetails_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderDetails_order_authorizedAmount;
- capturedAmount: OrderDetails_order_capturedAmount;
+ totalAuthorized: OrderDetails_order_totalAuthorized;
+ totalCaptured: OrderDetails_order_totalCaptured;
user: OrderDetails_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderDetails_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts b/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
index 3f7885e17a..0773d30b2d 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
@@ -198,13 +198,13 @@ export interface OrderDetailsFragment_total {
tax: OrderDetailsFragment_total_tax;
}
-export interface OrderDetailsFragment_authorizedAmount {
+export interface OrderDetailsFragment_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderDetailsFragment_capturedAmount {
+export interface OrderDetailsFragment_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -247,8 +247,8 @@ export interface OrderDetailsFragment {
subtotal: OrderDetailsFragment_subtotal | null;
total: OrderDetailsFragment_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderDetailsFragment_authorizedAmount;
- capturedAmount: OrderDetailsFragment_capturedAmount;
+ totalAuthorized: OrderDetailsFragment_totalAuthorized;
+ totalCaptured: OrderDetailsFragment_totalCaptured;
user: OrderDetailsFragment_user | null;
userEmail: string | null;
availableShippingMethods: (OrderDetailsFragment_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDraftCancel.ts b/saleor/static/dashboard-next/orders/types/OrderDraftCancel.ts
index 2b2942324c..a34d63be91 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDraftCancel.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDraftCancel.ts
@@ -198,13 +198,13 @@ export interface OrderDraftCancel_draftOrderDelete_order_total {
tax: OrderDraftCancel_draftOrderDelete_order_total_tax;
}
-export interface OrderDraftCancel_draftOrderDelete_order_authorizedAmount {
+export interface OrderDraftCancel_draftOrderDelete_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderDraftCancel_draftOrderDelete_order_capturedAmount {
+export interface OrderDraftCancel_draftOrderDelete_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -247,8 +247,8 @@ export interface OrderDraftCancel_draftOrderDelete_order {
subtotal: OrderDraftCancel_draftOrderDelete_order_subtotal | null;
total: OrderDraftCancel_draftOrderDelete_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderDraftCancel_draftOrderDelete_order_authorizedAmount;
- capturedAmount: OrderDraftCancel_draftOrderDelete_order_capturedAmount;
+ totalAuthorized: OrderDraftCancel_draftOrderDelete_order_totalAuthorized;
+ totalCaptured: OrderDraftCancel_draftOrderDelete_order_totalCaptured;
user: OrderDraftCancel_draftOrderDelete_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderDraftCancel_draftOrderDelete_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDraftFinalize.ts b/saleor/static/dashboard-next/orders/types/OrderDraftFinalize.ts
index b63a06373e..5156a7bc60 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDraftFinalize.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDraftFinalize.ts
@@ -204,13 +204,13 @@ export interface OrderDraftFinalize_draftOrderComplete_order_total {
tax: OrderDraftFinalize_draftOrderComplete_order_total_tax;
}
-export interface OrderDraftFinalize_draftOrderComplete_order_authorizedAmount {
+export interface OrderDraftFinalize_draftOrderComplete_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderDraftFinalize_draftOrderComplete_order_capturedAmount {
+export interface OrderDraftFinalize_draftOrderComplete_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderDraftFinalize_draftOrderComplete_order {
subtotal: OrderDraftFinalize_draftOrderComplete_order_subtotal | null;
total: OrderDraftFinalize_draftOrderComplete_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderDraftFinalize_draftOrderComplete_order_authorizedAmount;
- capturedAmount: OrderDraftFinalize_draftOrderComplete_order_capturedAmount;
+ totalAuthorized: OrderDraftFinalize_draftOrderComplete_order_totalAuthorized;
+ totalCaptured: OrderDraftFinalize_draftOrderComplete_order_totalCaptured;
user: OrderDraftFinalize_draftOrderComplete_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderDraftFinalize_draftOrderComplete_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts b/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
index 33c5a3dfa1..9bc1a31b35 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
@@ -204,13 +204,13 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_total {
tax: OrderDraftUpdate_draftOrderUpdate_order_total_tax;
}
-export interface OrderDraftUpdate_draftOrderUpdate_order_authorizedAmount {
+export interface OrderDraftUpdate_draftOrderUpdate_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderDraftUpdate_draftOrderUpdate_order_capturedAmount {
+export interface OrderDraftUpdate_draftOrderUpdate_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderDraftUpdate_draftOrderUpdate_order {
subtotal: OrderDraftUpdate_draftOrderUpdate_order_subtotal | null;
total: OrderDraftUpdate_draftOrderUpdate_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderDraftUpdate_draftOrderUpdate_order_authorizedAmount;
- capturedAmount: OrderDraftUpdate_draftOrderUpdate_order_capturedAmount;
+ totalAuthorized: OrderDraftUpdate_draftOrderUpdate_order_totalAuthorized;
+ totalCaptured: OrderDraftUpdate_draftOrderUpdate_order_totalCaptured;
user: OrderDraftUpdate_draftOrderUpdate_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderDraftUpdate_draftOrderUpdate_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderFulfillmentCancel.ts b/saleor/static/dashboard-next/orders/types/OrderFulfillmentCancel.ts
index 64438e5119..6b58780804 100644
--- a/saleor/static/dashboard-next/orders/types/OrderFulfillmentCancel.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderFulfillmentCancel.ts
@@ -204,13 +204,13 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_total {
tax: OrderFulfillmentCancel_orderFulfillmentCancel_order_total_tax;
}
-export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_authorizedAmount {
+export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_capturedAmount {
+export interface OrderFulfillmentCancel_orderFulfillmentCancel_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderFulfillmentCancel_orderFulfillmentCancel_order {
subtotal: OrderFulfillmentCancel_orderFulfillmentCancel_order_subtotal | null;
total: OrderFulfillmentCancel_orderFulfillmentCancel_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderFulfillmentCancel_orderFulfillmentCancel_order_authorizedAmount;
- capturedAmount: OrderFulfillmentCancel_orderFulfillmentCancel_order_capturedAmount;
+ totalAuthorized: OrderFulfillmentCancel_orderFulfillmentCancel_order_totalAuthorized;
+ totalCaptured: OrderFulfillmentCancel_orderFulfillmentCancel_order_totalCaptured;
user: OrderFulfillmentCancel_orderFulfillmentCancel_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderFulfillmentCancel_orderFulfillmentCancel_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderFulfillmentUpdateTracking.ts b/saleor/static/dashboard-next/orders/types/OrderFulfillmentUpdateTracking.ts
index ae06852746..41577365f4 100644
--- a/saleor/static/dashboard-next/orders/types/OrderFulfillmentUpdateTracking.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderFulfillmentUpdateTracking.ts
@@ -204,13 +204,13 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
tax: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_total_tax;
}
-export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_authorizedAmount {
+export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_capturedAmount {
+export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_o
subtotal: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_subtotal | null;
total: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_authorizedAmount;
- capturedAmount: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_capturedAmount;
+ totalAuthorized: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_totalAuthorized;
+ totalCaptured: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_totalCaptured;
user: OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderFulfillmentUpdateTracking_orderFulfillmentUpdateTracking_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts b/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
index cf4ab3535e..fc2b7ae1dc 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
@@ -204,13 +204,13 @@ export interface OrderLineAdd_draftOrderLineCreate_order_total {
tax: OrderLineAdd_draftOrderLineCreate_order_total_tax;
}
-export interface OrderLineAdd_draftOrderLineCreate_order_authorizedAmount {
+export interface OrderLineAdd_draftOrderLineCreate_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderLineAdd_draftOrderLineCreate_order_capturedAmount {
+export interface OrderLineAdd_draftOrderLineCreate_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderLineAdd_draftOrderLineCreate_order {
subtotal: OrderLineAdd_draftOrderLineCreate_order_subtotal | null;
total: OrderLineAdd_draftOrderLineCreate_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderLineAdd_draftOrderLineCreate_order_authorizedAmount;
- capturedAmount: OrderLineAdd_draftOrderLineCreate_order_capturedAmount;
+ totalAuthorized: OrderLineAdd_draftOrderLineCreate_order_totalAuthorized;
+ totalCaptured: OrderLineAdd_draftOrderLineCreate_order_totalCaptured;
user: OrderLineAdd_draftOrderLineCreate_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderLineAdd_draftOrderLineCreate_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts b/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
index a05a0fb368..5ffcb7d998 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
@@ -204,13 +204,13 @@ export interface OrderLineDelete_draftOrderLineDelete_order_total {
tax: OrderLineDelete_draftOrderLineDelete_order_total_tax;
}
-export interface OrderLineDelete_draftOrderLineDelete_order_authorizedAmount {
+export interface OrderLineDelete_draftOrderLineDelete_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderLineDelete_draftOrderLineDelete_order_capturedAmount {
+export interface OrderLineDelete_draftOrderLineDelete_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderLineDelete_draftOrderLineDelete_order {
subtotal: OrderLineDelete_draftOrderLineDelete_order_subtotal | null;
total: OrderLineDelete_draftOrderLineDelete_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderLineDelete_draftOrderLineDelete_order_authorizedAmount;
- capturedAmount: OrderLineDelete_draftOrderLineDelete_order_capturedAmount;
+ totalAuthorized: OrderLineDelete_draftOrderLineDelete_order_totalAuthorized;
+ totalCaptured: OrderLineDelete_draftOrderLineDelete_order_totalCaptured;
user: OrderLineDelete_draftOrderLineDelete_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderLineDelete_draftOrderLineDelete_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts b/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
index 5548ef3f9f..c30477691c 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
@@ -204,13 +204,13 @@ export interface OrderLineUpdate_draftOrderLineUpdate_order_total {
tax: OrderLineUpdate_draftOrderLineUpdate_order_total_tax;
}
-export interface OrderLineUpdate_draftOrderLineUpdate_order_authorizedAmount {
+export interface OrderLineUpdate_draftOrderLineUpdate_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderLineUpdate_draftOrderLineUpdate_order_capturedAmount {
+export interface OrderLineUpdate_draftOrderLineUpdate_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderLineUpdate_draftOrderLineUpdate_order {
subtotal: OrderLineUpdate_draftOrderLineUpdate_order_subtotal | null;
total: OrderLineUpdate_draftOrderLineUpdate_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderLineUpdate_draftOrderLineUpdate_order_authorizedAmount;
- capturedAmount: OrderLineUpdate_draftOrderLineUpdate_order_capturedAmount;
+ totalAuthorized: OrderLineUpdate_draftOrderLineUpdate_order_totalAuthorized;
+ totalCaptured: OrderLineUpdate_draftOrderLineUpdate_order_totalCaptured;
user: OrderLineUpdate_draftOrderLineUpdate_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderLineUpdate_draftOrderLineUpdate_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderMarkAsPaid.ts b/saleor/static/dashboard-next/orders/types/OrderMarkAsPaid.ts
index 41a6f62bac..a7a667bd95 100644
--- a/saleor/static/dashboard-next/orders/types/OrderMarkAsPaid.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderMarkAsPaid.ts
@@ -204,13 +204,13 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order_total {
tax: OrderMarkAsPaid_orderMarkAsPaid_order_total_tax;
}
-export interface OrderMarkAsPaid_orderMarkAsPaid_order_authorizedAmount {
+export interface OrderMarkAsPaid_orderMarkAsPaid_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderMarkAsPaid_orderMarkAsPaid_order_capturedAmount {
+export interface OrderMarkAsPaid_orderMarkAsPaid_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderMarkAsPaid_orderMarkAsPaid_order {
subtotal: OrderMarkAsPaid_orderMarkAsPaid_order_subtotal | null;
total: OrderMarkAsPaid_orderMarkAsPaid_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderMarkAsPaid_orderMarkAsPaid_order_authorizedAmount;
- capturedAmount: OrderMarkAsPaid_orderMarkAsPaid_order_capturedAmount;
+ totalAuthorized: OrderMarkAsPaid_orderMarkAsPaid_order_totalAuthorized;
+ totalCaptured: OrderMarkAsPaid_orderMarkAsPaid_order_totalCaptured;
user: OrderMarkAsPaid_orderMarkAsPaid_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderMarkAsPaid_orderMarkAsPaid_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderRefund.ts b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
index eb8021f9d9..8a3cd34917 100644
--- a/saleor/static/dashboard-next/orders/types/OrderRefund.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
@@ -204,13 +204,13 @@ export interface OrderRefund_orderRefund_order_total {
tax: OrderRefund_orderRefund_order_total_tax;
}
-export interface OrderRefund_orderRefund_order_authorizedAmount {
+export interface OrderRefund_orderRefund_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderRefund_orderRefund_order_capturedAmount {
+export interface OrderRefund_orderRefund_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -253,8 +253,8 @@ export interface OrderRefund_orderRefund_order {
subtotal: OrderRefund_orderRefund_order_subtotal | null;
total: OrderRefund_orderRefund_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderRefund_orderRefund_order_authorizedAmount;
- capturedAmount: OrderRefund_orderRefund_order_capturedAmount;
+ totalAuthorized: OrderRefund_orderRefund_order_totalAuthorized;
+ totalCaptured: OrderRefund_orderRefund_order_totalCaptured;
user: OrderRefund_orderRefund_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderRefund_orderRefund_order_availableShippingMethods | null)[] | null;
diff --git a/saleor/static/dashboard-next/orders/types/OrderVoid.ts b/saleor/static/dashboard-next/orders/types/OrderVoid.ts
index bebe81fd13..4b55860c10 100644
--- a/saleor/static/dashboard-next/orders/types/OrderVoid.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderVoid.ts
@@ -198,13 +198,13 @@ export interface OrderVoid_orderVoid_order_total {
tax: OrderVoid_orderVoid_order_total_tax;
}
-export interface OrderVoid_orderVoid_order_authorizedAmount {
+export interface OrderVoid_orderVoid_order_totalAuthorized {
__typename: "Money";
amount: number;
currency: string;
}
-export interface OrderVoid_orderVoid_order_capturedAmount {
+export interface OrderVoid_orderVoid_order_totalCaptured {
__typename: "Money";
amount: number;
currency: string;
@@ -247,8 +247,8 @@ export interface OrderVoid_orderVoid_order {
subtotal: OrderVoid_orderVoid_order_subtotal | null;
total: OrderVoid_orderVoid_order_total | null;
actions: (OrderAction | null)[];
- authorizedAmount: OrderVoid_orderVoid_order_authorizedAmount;
- capturedAmount: OrderVoid_orderVoid_order_capturedAmount;
+ totalAuthorized: OrderVoid_orderVoid_order_totalAuthorized;
+ totalCaptured: OrderVoid_orderVoid_order_totalCaptured;
user: OrderVoid_orderVoid_order_user | null;
userEmail: string | null;
availableShippingMethods: (OrderVoid_orderVoid_order_availableShippingMethods | null)[] | null;
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 8c0427fe79..5777182a5e 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -126,7 +126,7 @@
</td>
<td class="right-align">
<strong>
- {% price order.balance_amount %}
+ {% price order.total_balance %}
</strong>
</td>
</tr>
diff --git a/tests/api/test_order.py b/tests/api/test_order.py
index 1cd713e1c9..af69fab58b 100644
--- a/tests/api/test_order.py
+++ b/tests/api/test_order.py
@@ -908,7 +908,7 @@ def test_order_capture(
order {
paymentStatus
isPaid
- capturedAmount {
+ totalCaptured {
amount
}
}
@@ -925,7 +925,7 @@ def test_order_capture(
order.refresh_from_db()
assert data['paymentStatus'] == PaymentChargeStatusEnum.CHARGED.name
assert data['isPaid']
- assert data['capturedAmount']['amount'] == float(amount)
+ assert data['totalCaptured']['amount'] == float(amount)
event_order_paid = order.events.first()
assert event_order_paid.type == OrderEvents.ORDER_FULLY_PAID.value
diff --git a/tests/test_payment_braintree.py b/tests/test_payment_braintree.py
index 6b27ffc780..3ddf95b695 100644
--- a/tests/test_payment_braintree.py
+++ b/tests/test_payment_braintree.py
@@ -106,7 +106,6 @@ def test_get_customer_data(payment_dummy):
assert result == expected_result
-
def test_get_error_for_client(braintree_error, monkeypatch):
# no error
assert get_error_for_client([]) == ''
@@ -115,14 +114,19 @@ def test_get_error_for_client(braintree_error, monkeypatch):
# error not whitelisted
monkeypatch.setattr(
- 'saleor.payment.providers.braintree.ERROR_CODES_WHITELIST', [])
+ 'saleor.payment.providers.braintree.ERROR_CODES_WHITELIST', {})
assert get_error_for_client([error]) == DEFAULT_ERROR
monkeypatch.setattr(
'saleor.payment.providers.braintree.ERROR_CODES_WHITELIST',
- [braintree_error.code])
+ {braintree_error.code: ''})
assert get_error_for_client([error]) == braintree_error.message
+ monkeypatch.setattr(
+ 'saleor.payment.providers.braintree.ERROR_CODES_WHITELIST',
+ {braintree_error.code: 'Error msg override'})
+ assert get_error_for_client([error]) == 'Error msg override'
+
def test_extract_gateway_response(braintree_success_response):
result = extract_gateway_response(braintree_success_response)