Skip to content

Commit

Permalink
Update flows
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Jun 27, 2024
1 parent efcbda6 commit fae0ce3
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 11 deletions.
33 changes: 29 additions & 4 deletions packages/demo-wallet-client/src/components/Sep6/Sep6Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,17 @@ export const Sep6Deposit = () => {
) => {
const { id, value } = event.target;

let fields = { ...formData.customerFields };

if (value) {
fields[id] = value;
} else if (fields[id]) {
delete fields[id];
}

const updatedState = {
...formData,
customerFields: {
...formData.customerFields,
[id]: value,
},
customerFields: fields,
};

setFormData(updatedState);
Expand Down Expand Up @@ -360,6 +365,26 @@ export const Sep6Deposit = () => {
);
}

if (sep6DepositAsset.status === ActionStatus.KYC_DONE) {
return (
<Modal
visible={isInfoModalVisible}
onClose={() => setIsInfoModalVisible(false)}
parentId={CSS_MODAL_PARENT_ID}
>
<Modal.Heading>SEP-6 Deposit</Modal.Heading>

<Modal.Body>
<p>Submit the deposit.</p>
</Modal.Body>

<Modal.Footer>
<Button onClick={() => dispatch(sep6DepositAction())}>Submit</Button>
</Modal.Footer>
</Modal>
);
}

if (sep6DepositAsset.data.instructions) {
return (
<Modal
Expand Down
33 changes: 29 additions & 4 deletions packages/demo-wallet-client/src/components/Sep6/Sep6Withdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,17 @@ export const Sep6Withdraw = () => {
) => {
const { id, value } = event.target;

let fields = { ...formData.customerFields };

if (value) {
fields[id] = value;
} else if (fields[id]) {
delete fields[id];
}

const updatedState = {
...formData,
customerFields: {
...formData.customerFields,
[id]: value,
},
customerFields: fields,
};

setFormData(updatedState);
Expand Down Expand Up @@ -383,6 +388,26 @@ export const Sep6Withdraw = () => {
);
}

if (sep6WithdrawAsset.status === ActionStatus.KYC_DONE) {
return (
<Modal
visible={isInfoModalVisible}
onClose={() => setIsInfoModalVisible(false)}
parentId={CSS_MODAL_PARENT_ID}
>
<Modal.Heading>SEP-6 Withdrawal</Modal.Heading>

<Modal.Body>
<p>Submit the withdrawal.</p>
</Modal.Body>

<Modal.Footer>
<Button onClick={handleAmountSubmit}>Submit</Button>
</Modal.Footer>
</Modal>
);
}

if (sep6WithdrawAsset.status === ActionStatus.SUCCESS) {
return (
<Modal
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-wallet-client/src/ducks/sep6DepositAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export const submitSep6CustomerInfoFields = createAsyncThunk<
}

return {
status: ActionStatus.CAN_PROCEED,
status: ActionStatus.KYC_DONE,
};
} catch (e) {
const errorMessage = getErrorMessage(e);
Expand Down
4 changes: 2 additions & 2 deletions packages/demo-wallet-client/src/ducks/sep6WithdrawAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const sep6WithdrawAction = createAsyncThunk<
transactionResponse: transaction,
status:
currentStatus === TransactionStatus.PENDING_CUSTOMER_INFO_UPDATE
? ActionStatus.NEEDS_INPUT
? ActionStatus.NEEDS_KYC
: ActionStatus.SUCCESS,
requiredCustomerInfoUpdates,
customerFields,
Expand Down Expand Up @@ -336,7 +336,7 @@ export const submitSep6WithdrawCustomerInfoFields = createAsyncThunk<
}

return {
status: ActionStatus.CAN_PROCEED,
status: ActionStatus.KYC_DONE,
};
} catch (e) {
const errorMessage = getErrorMessage(e);
Expand Down
1 change: 1 addition & 0 deletions packages/demo-wallet-client/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ export enum ActionStatus {
SUCCESS = "SUCCESS",
NEEDS_INPUT = "NEEDS_INPUT",
NEEDS_KYC = "NEEDS_KYC",
KYC_DONE = "KYC_DONE",
CAN_PROCEED = "CAN_PROCEED",
ANCHOR_QUOTES = "ANCHOR_QUOTES",
}
Expand Down

0 comments on commit fae0ce3

Please sign in to comment.