Skip to content

Commit

Permalink
feat(frictions): rely on products endpoint for buy and sell instead
Browse files Browse the repository at this point in the history
  • Loading branch information
dkremniov-bc committed Jan 16, 2024
1 parent d2a3d5f commit 2ffbff8
Showing 1 changed file with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,18 @@ export default ({ api, coreSagas, networks }: { api: APIType; coreSagas: any; ne

// show sanctions for buy
if (products?.buy?.reasonNotEligible) {
if (products.buy.reasonNotEligible.reason === 'NOT_ELIGIBLE') {
const steps = yield* typedCall(api.fetchVerificationSteps)
if (steps.items[steps.items.length - 1].status === 'DISABLED') {
yield put(
actions.modals.showModal(ModalName.COMPLETE_USER_PROFILE, { origin: 'BuySellInit' })
)
yield put(actions.modals.closeModal(ModalName.SIMPLE_BUY_MODAL))

return
}
}

const message =
products.buy.reasonNotEligible.reason !== CustodialSanctionsEnum.EU_5_SANCTION
? products.buy.reasonNotEligible.message
Expand All @@ -2050,6 +2062,18 @@ export default ({ api, coreSagas, networks }: { api: APIType; coreSagas: any; ne
}
// show sanctions for sell
if (products?.sell?.reasonNotEligible && orderType === OrderType.SELL) {
if (products.sell.reasonNotEligible.reason === 'NOT_ELIGIBLE') {
const steps = yield* typedCall(api.fetchVerificationSteps)
if (steps.items[steps.items.length - 1].status === 'DISABLED') {
yield put(
actions.modals.showModal(ModalName.COMPLETE_USER_PROFILE, { origin: 'BuySellInit' })
)
yield put(actions.modals.closeModal(ModalName.SIMPLE_BUY_MODAL))

return
}
}

const message =
products.sell.reasonNotEligible.reason !== CustodialSanctionsEnum.EU_5_SANCTION
? products.sell.reasonNotEligible.message
Expand All @@ -2066,16 +2090,6 @@ export default ({ api, coreSagas, networks }: { api: APIType; coreSagas: any; ne
return
}

const steps = yield* typedCall(api.fetchVerificationSteps)
if (steps.items[steps.items.length - 1].status === 'DISABLED') {
yield put(
actions.modals.showModal(ModalName.COMPLETE_USER_PROFILE, { origin: 'BuySellInit' })
)
yield put(actions.modals.closeModal(ModalName.SIMPLE_BUY_MODAL))

return
}

// Check if there is a pending_deposit Open Banking order
if (latestPendingOrder) {
const bankAccount = yield call(getBankInformation, latestPendingOrder)
Expand Down

0 comments on commit 2ffbff8

Please sign in to comment.