Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #961

Merged
merged 1 commit into from
Feb 18, 2023
Merged

fix #961

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/SoraCard/steps/KycView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export default class KycView extends Mixins(TranslationMixin) {
const referenceNumber = await this.getReferenceNumber(soraProxy.referenceNumberEndpoint);
await unloadScript(kycService.sdkURL).catch(() => {});
loadScript(kycService.sdkURL)
.then(() => {
// @ts-expect-error no-undef
Expand Down
16 changes: 12 additions & 4 deletions src/components/SoraCard/steps/Phone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,16 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
this.smsResendText = `RESEND IN 0:${countDown}`;
}
verifyCode(): void {
// TODO: check for length before sending
@Watch('isEuroBalanceEnough', { immediate: true })
private handleXorDeposit(isEnough: boolean): void {
if (isEnough) {
this.notPassedKycAndNotHasXorEnough = false;
this.verificationCode = '';
this.smsSent = false;
}
}
verifyCode(): void {
this.authLogin.PayWingsOtpCredentialVerification(this.verificationCode).catch((error) => {
this.sendOtpBtnLoading = false;
this.verificationCode = '';
Expand All @@ -109,7 +116,7 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
type: 'error',
title: '',
});
console.error(error);
console.error('[SoraCard]: Auth', error);
});
this.sendOtpBtnLoading = true;
Expand All @@ -119,7 +126,7 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
this.authLogin
.PayWingsSendOtp(`${this.countryCode}${this.phoneNumber}`, 'Your verification code is: @Otp')
.catch((error) => {
console.error(error);
console.error('[SoraCard]: Auth', error);
});
this.startSmsCountDown();
Expand Down Expand Up @@ -213,6 +220,7 @@ export default class Phone extends Mixins(TranslationMixin, mixins.LoadingMixin)
if (this.smsResendCount < 0) {
this.smsSent = false;
this.verificationCode = '';
this.smsResendCount = RESEND_INTERVAL;
clearInterval(interval);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SoraCard/steps/RoadMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class RoadMap extends Mixins(TranslationMixin, mixins.LoadingMixi
if (!mediaDevicesAllowance) return;
} catch (error) {
console.error('[KYC Sora Card]: Camera error.', error);
console.error('[SoraCard]: Camera error.', error);
}
this.$emit('confirm');
Expand Down
6 changes: 5 additions & 1 deletion src/store/soraCard/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { waitForAccountPair } from '@/utils';
import { defineUserStatus, getXorPerEuroRatio, soraCard } from '@/utils/card';
import { soraCardActionContext } from './../soraCard';
import { Status } from '@/types/card';
import { loadScript } from 'vue-plugin-load-script';
import { loadScript, unloadScript } from 'vue-plugin-load-script';

const actions = defineActions({
calculateXorRestPrice(context, xorPerEuro: FPNumber): void {
Expand Down Expand Up @@ -75,6 +75,10 @@ const actions = defineActions({
const soraNetwork = rootState.wallet.settings.soraNetwork || WALLET_CONSTS.SoraNetwork.Test;
const { authService } = soraCard(soraNetwork);

await unloadScript(authService.sdkURL).catch(() => {
/* no need to handle */
});

await loadScript(authService.sdkURL).then(() => {
// TODO: annotate via TS main calls
// @ts-expect-error no undefined
Expand Down