import KycActionRequired from "./KycActionRequired"; import ExecuteOrderButton from "../../elements/tradepanel/ExecuteOrderButton"; import Modal from "../Modal"; import KYCForm from "../KYCForm"; import KycStatus from "liminal.market/dist/dto/KycStatus"; export default class KycStatusHandler { kycResponse: KycStatus; executeTradeButton: ExecuteOrderButton; constructor(kycResponse: any, executeTradeButton: ExecuteOrderButton) { this.kycResponse = kycResponse; this.executeTradeButton = executeTradeButton; } public getButtonText() { let txt = "Finish registration"; switch (this.kycResponse.status) { case "SUBMITTED": case "ONBOARDING": case "INACTIVE": case "APPROVED": case "EDITED": case "APPROVAL_PENDING": txt = "Submitted to KYC processor"; break; case "ACTION_REQUIRED": txt = "Action required. Click to continue"; break; case "REJECTED": txt = "Your application was rejected"; break; case "DISABLED": txt = "Your account has been disabled"; break; case "ACTIVE": case "ACCOUNT_UPDATED": txt = "You are approved. KYC is being sent to blockchain. Give it few minutes"; break; case "ACCOUNT_CLOSED": txt = "Your account has been closed"; break; } return txt + "Click for more info"; } public getButtonClickEvent(executeTradeButton: ExecuteOrderButton) { switch (this.kycResponse.status) { case "SUBMITTED": case "ONBOARDING": case "INACTIVE": case "APPROVED": case "EDITED": case "APPROVAL_PENDING": return this.showModal( "Application is being processed", "You need to wait for KYC to be approved. Then you'll be able to do trades. " + "This usually takes few minutes for the first submission, but can take longer for second submission. " + "We will email you when you are approved or if there are problems

" + "If this status has been for more than 1 day, and you haven't gotten any email from us. Please email us at " + "info@liminal.market" ); case "ACTION_REQUIRED": return async () => { let kycActionRequired = new KycActionRequired(executeTradeButton); await kycActionRequired.show(); }; case "REJECTED": return this.showModal( "Application was rejected", "Your application has been rejected during KYC process.

" + "We don't have the information on why that happened, but you can email us at " + "info@liminal.market" + " and we can find out, and we should be able to solve it together." ); case "DISABLED": return this.showModal( "Application was disabled", "Your account has been disabled.

" + "We don't have the information on why that happened, but you can email us at " + "info@liminal.market" + " and we can find out, and we should be able to solve it together." ); case "ACCOUNT_CLOSED": return this.showModal( "Application was closed", "Your account has been closed.

" + "We don't have the information on why that happened, but you can email us at " + "info@liminal.market" + " and we can find out, and we should be able to solve it together." ); case "ACCOUNT_UPDATED": case "ACTIVE": return this.showModal( "Account soon ready", "Your account has been approved...

" + "..but, after we approve your account, we write the information to the blockchain." + " This usually takes just few(2-3) minutes.

If this is taking longer, " + 'please email us at info@liminal.market' ); } return () => { let kycForm = new KYCForm(async () => { await this.executeTradeButton.renderButton(); }); kycForm.showKYCForm(); }; } public showModal(title: string, content: string) { return () => { let modal = new Modal(); modal.showModal(title, content); }; } }