aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-09-06 13:08:26 -0300
committerSebastian <sebasjm@gmail.com>2024-09-06 13:14:14 -0300
commitd671ef0f4cfa7d17b43b265501ae595882549f17 (patch)
treebbe14372d35da6aba23bbf46b3179f5d95b03b63 /packages/merchant-backoffice-ui
parent726df07be957dbc053ff633242ca3c4bd752e8fd (diff)
downloadwallet-core-d671ef0f4cfa7d17b43b265501ae595882549f17.tar.xz
update to exchange v21 and merchant v17
Diffstat (limited to 'packages/merchant-backoffice-ui')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx6
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx17
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx39
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx30
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx32
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/templates/use/index.tsx39
6 files changed, 122 insertions, 41 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx
index 046636b4b..44fa429a4 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx
@@ -37,18 +37,18 @@ export const Example = tests.createExample(TestedComponent, {
timeout_kycs: [],
pending_kycs: [
{
- aml_status: 0,
exchange_url: "http://exchange.taler",
payto_uri: "payto://iban/de123123123" as PaytoString,
kyc_url: "http://exchange.taler/kyc",
+ exchange_http_status: 0,
},
{
- aml_status: 1,
+ exchange_http_status: 1,
exchange_url: "http://exchange.taler",
payto_uri: "payto://iban/de123123123" as PaytoString,
},
{
- aml_status: 2,
+ exchange_http_status: 2,
exchange_url: "http://exchange.taler",
payto_uri: "payto://iban/de123123123" as PaytoString,
},
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx
index 3eeed1d7b..16bbd4b18 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx
@@ -119,18 +119,11 @@ function PendingTable({ entries }: PendingTableProps): VNode {
<td>{e.exchange_url}</td>
<td>{e.payto_uri}</td>
<td>
- {e.aml_status === 1 ? (
- <i18n.Translate>
- There is an anti-money laundering process pending to
- complete.
- </i18n.Translate>
- ) : (
- <i18n.Translate>
- The account is frozen due to the anti-money laundering
- rules. Contact the exchange service provider for further
- instructions.
- </i18n.Translate>
- )}
+ <i18n.Translate>
+ There is an anti-money laundering process pending to
+ complete.
+ </i18n.Translate>
+
</td>
</tr>
);
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx
index 0ce2c331d..0dc125706 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/index.tsx
@@ -103,14 +103,37 @@ export default function OrderCreate({ onConfirm, onBack }: Props): VNode {
if (resp.type === "ok") {
return onConfirm(resp.body.order_id);
} else {
- setNotif({
- message: i18n.str`Could not create order`,
- type: "ERROR",
- description:
- resp.case === HttpStatusCode.Gone
- ? i18n.str`No more stock for product with id "${resp.body.product_id}".`
- : resp.detail?.hint,
- });
+ switch (resp.case) {
+ case HttpStatusCode.UnavailableForLegalReasons: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: i18n.str`No exchange would accept a payment because of KYC requirements.`
+ });
+ return;
+ }
+ case HttpStatusCode.Unauthorized:
+ case HttpStatusCode.NotFound:
+ case HttpStatusCode.Conflict: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: resp.detail?.hint,
+ });
+ return;
+ }
+ case HttpStatusCode.Gone: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: i18n.str`No more stock for product with id "${resp.body.product_id}".`
+ });
+ return;
+ }
+ default: {
+ assertUnreachable(resp)
+ }
+ }
}
})
.catch((error) => {
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx
index 5da500dc0..c7edce834 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/index.tsx
@@ -89,11 +89,31 @@ export default function Update({ oid, onBack }: Props): VNode {
type: "SUCCESS",
});
} else {
- setNotif({
- message: i18n.str`Could not create the refund`,
- type: "ERROR",
- description: resp.detail?.hint,
- });
+ switch (resp.case) {
+ case HttpStatusCode.UnavailableForLegalReasons: {
+ setNotif({
+ message: i18n.str`Could not create the refund`,
+ type: "ERROR",
+ description: i18n.str`There are pending KYC requirements.`
+ });
+ return;
+ }
+ case HttpStatusCode.Unauthorized:
+ case HttpStatusCode.Forbidden:
+ case HttpStatusCode.NotFound:
+ case HttpStatusCode.Conflict:
+ case HttpStatusCode.Gone: {
+ setNotif({
+ message: i18n.str`Could not create the refund`,
+ type: "ERROR",
+ description: resp.detail?.hint,
+ });
+ return;
+ }
+ default: {
+ assertUnreachable(resp)
+ }
+ }
}
})
.catch((error) =>
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx
index 450585a9f..787512e2a 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/index.tsx
@@ -164,11 +164,33 @@ export default function OrderList({ onCreate, onSelect }: Props): VNode {
type: "SUCCESS",
});
} else {
- setNotif({
- message: i18n.str`Could not create the refund`,
- type: "ERROR",
- description: resp.detail?.hint,
- });
+ switch (resp.case) {
+ case HttpStatusCode.UnavailableForLegalReasons: {
+ setNotif({
+ message: i18n.str`Could not create the refund`,
+ type: "ERROR",
+ description: i18n.str`There are pending KYC requirements.`
+ });
+ return;
+ }
+ case HttpStatusCode.Unauthorized:
+ case HttpStatusCode.Forbidden:
+ case HttpStatusCode.NotFound:
+ case HttpStatusCode.Conflict:
+ case HttpStatusCode.Gone: {
+ setNotif({
+ message: i18n.str`Could not create the refund`,
+ type: "ERROR",
+ description: resp.detail?.hint,
+ });
+ return;
+ }
+ default: {
+ assertUnreachable(resp)
+ }
+
+ }
+
}
})
.catch((error) =>
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/use/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/use/index.tsx
index e8a0c3eba..504932ecb 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/templates/use/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/use/index.tsx
@@ -87,14 +87,37 @@ export default function TemplateUsePage({
if (resp.type === "ok") {
onOrderCreated(resp.body.order_id)
} else {
- setNotif({
- message: i18n.str`Could not create order from template`,
- type: "ERROR",
- description:
- resp.case === HttpStatusCode.Gone
- ? i18n.str`No more stock for product with id "${resp.body.product_id}".`
- : resp.detail?.hint,
- });
+ switch (resp.case) {
+ case HttpStatusCode.UnavailableForLegalReasons: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: i18n.str`No exchange would accept a payment because of KYC requirements.`
+ });
+ return;
+ }
+ case HttpStatusCode.Unauthorized:
+ case HttpStatusCode.NotFound:
+ case HttpStatusCode.Conflict: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: resp.detail?.hint,
+ });
+ return;
+ }
+ case HttpStatusCode.Gone: {
+ setNotif({
+ message: i18n.str`Could not create order`,
+ type: "ERROR",
+ description: i18n.str`No more stock for product with id "${resp.body.product_id}".`
+ });
+ return;
+ }
+ default: {
+ assertUnreachable(resp)
+ }
+ }
}
})
.catch((error) => {