Skip to content

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

Support partially charged and partially refunded in dashboard 2.0

Unknown0d4dd1bc34fd
diff --git a/saleor/static/dashboard-next/customers/fixtures.ts b/saleor/static/dashboard-next/customers/fixtures.ts
index d3f33bb74a..5393191a1b 100644
--- a/saleor/static/dashboard-next/customers/fixtures.ts
+++ b/saleor/static/dashboard-next/customers/fixtures.ts
@@ -1015,7 +1015,7 @@ export const customer: CustomerDetails_user = {
created: "2018-05-07T09:37:30.124154+00:00",
id: "T3JkZXI6MTk=",
number: "8234",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
total: {
__typename: "TaxedMoney",
gross: {
diff --git a/saleor/static/dashboard-next/misc.ts b/saleor/static/dashboard-next/misc.ts
index 544b81398e..dc29110708 100644
--- a/saleor/static/dashboard-next/misc.ts
+++ b/saleor/static/dashboard-next/misc.ts
@@ -55,10 +55,14 @@ export const removeDoubleSlashes = (url: string) =>
export const transformPaymentStatus = (status: string) => {
switch (status) {
- case PaymentChargeStatusEnum.CHARGED:
- return { localized: i18n.t("Paid"), status: "success" };
+ case PaymentChargeStatusEnum.PARTIALLY_CHARGED:
+ return { localized: i18n.t("Partially paid"), status: "error" };
+ case PaymentChargeStatusEnum.FULLY_CHARGED:
+ return { localized: i18n.t("Fully paid"), status: "success" };
+ case PaymentChargeStatusEnum.PARTIALLY_REFUNDED:
+ return { localized: i18n.t("Partially refunded"), status: "error" };
case PaymentChargeStatusEnum.FULLY_REFUNDED:
- return { localized: i18n.t("Refunded"), status: "success" };
+ return { localized: i18n.t("Fully refunded"), status: "success" };
default:
return { localized: i18n.t("Unpaid"), status: "error" };
}
diff --git a/saleor/static/dashboard-next/orders/fixtures.ts b/saleor/static/dashboard-next/orders/fixtures.ts
index dcd8aef713..cff844186a 100644
--- a/saleor/static/dashboard-next/orders/fixtures.ts
+++ b/saleor/static/dashboard-next/orders/fixtures.ts
@@ -57,7 +57,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:30.376876+00:00",
id: "T3JkZXI6MjA=",
number: "20",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.CANCELED,
total: {
__typename: "TaxedMoney",
@@ -93,7 +93,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:30.124154+00:00",
id: "T3JkZXI6MTk=",
number: "19",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.CANCELED,
total: {
__typename: "TaxedMoney",
@@ -363,7 +363,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:28.598246+00:00",
id: "T3JkZXI6MTE=",
number: "11",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.UNFULFILLED,
total: {
__typename: "TaxedMoney",
@@ -507,7 +507,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:27.828033+00:00",
id: "T3JkZXI6Nw==",
number: "7",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.PARTIALLY_FULFILLED,
total: {
__typename: "TaxedMoney",
@@ -687,7 +687,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:26.751359+00:00",
id: "T3JkZXI6Mg==",
number: "2",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.PARTIALLY_FULFILLED,
total: {
__typename: "TaxedMoney",
@@ -723,7 +723,7 @@ export const orders: OrderList_orders_edges_node[] = [
created: "2018-09-11T09:37:26.314968+00:00",
id: "T3JkZXI6MQ==",
number: "1",
- paymentStatus: PaymentChargeStatusEnum.CHARGED,
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
status: OrderStatus.PARTIALLY_FULFILLED,
total: {
__typename: "TaxedMoney",
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
index 95b65eddd3..4d453b6def 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDetailsPage.tsx
@@ -61,7 +61,7 @@ storiesOf("Views / Orders / Order details", module)
{...props}
order={{
...props.order,
- paymentStatus: PaymentChargeStatusEnum.CHARGED
+ paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED
}}
/>
))
diff --git a/tests/api/test_order.py b/tests/api/test_order.py
index bf7c882d49..e77838c3d6 100644
--- a/tests/api/test_order.py
+++ b/tests/api/test_order.py
@@ -964,7 +964,7 @@ def test_order_capture(
content = get_graphql_content(response)
data = content['data']['orderCapture']['order']
order.refresh_from_db()
- assert data['paymentStatus'] == PaymentChargeStatusEnum.CHARGED.name
+ assert data['paymentStatus'] == PaymentChargeStatusEnum.FULLY_CHARGED.name
payment_status_display = dict(ChargeStatus.CHOICES).get(
ChargeStatus.FULLY_CHARGED)
assert data['paymentStatusDisplay'] == payment_status_display
diff --git a/tests/api/test_payment.py b/tests/api/test_payment.py
index f9f5933884..5575c53749 100644
--- a/tests/api/test_payment.py
+++ b/tests/api/test_payment.py
@@ -310,7 +310,7 @@ def test_payments_query(
assert data['capturedAmount'] == {
'amount': pay.captured_amount, 'currency': pay.currency}
assert data['total'] == {'amount': pay.total, 'currency': pay.currency}
- assert data['chargeStatus'] == PaymentChargeStatusEnum.CHARGED.name
+ assert data['chargeStatus'] == PaymentChargeStatusEnum.FULLY_CHARGED.name
assert data['billingAddress'] == {
'firstName': pay.billing_first_name,
'lastName': pay.billing_last_name,
diff --git a/tests/gateway/test_dummy.py b/tests/gateway/test_dummy.py
index a45f45e6cf..8ab60aa7e2 100644
--- a/tests/gateway/test_dummy.py
+++ b/tests/gateway/test_dummy.py
@@ -140,7 +140,7 @@ def test_void_gateway_error(payment_txn_preauth, monkeypatch):
@pytest.mark.parametrize(
- 'amount', 'charge_status', [
+ 'amount, charge_status', [
(80, ChargeStatus.FULLY_CHARGED),
(70, ChargeStatus.PARTIALLY_CHARGED), ])
def test_capture_success(amount, charge_status, payment_txn_preauth):