From 3bb56230484f4f37db1ff1e6da4c27a159f5f53a Mon Sep 17 00:00:00 2001 From: Yannick1712 Date: Sun, 9 Oct 2022 20:19:44 +0200 Subject: [PATCH 1/5] [DEV-847] add buyCrypto Pending Mails --- .../buy-crypto/entities/buy-crypto.entity.ts | 12 ++++- .../buy-crypto-notification.service.ts | 52 ++++++++++++++++++- src/shared/i18n/de/mail.json | 12 +++++ src/shared/i18n/en/mail.json | 12 +++++ src/shared/i18n/es/mail.json | 12 +++++ src/shared/i18n/fr/mail.json | 12 +++++ src/shared/i18n/it/mail.json | 12 +++++ src/shared/i18n/pt/mail.json | 12 +++++ 8 files changed, 133 insertions(+), 3 deletions(-) diff --git a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts index bb536420e1..5d4b640125 100644 --- a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts +++ b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts @@ -196,9 +196,17 @@ export class BuyCrypto extends IEntity { } get translationKey(): string { - return this.inputReferenceAsset === this.outputReferenceAsset + return this.inputReferenceAsset === this.outputReferenceAsset && this.amlCheck !== AmlCheck.PENDING ? 'mail.payment.deposit.buyCryptoCrypto' - : 'mail.payment.deposit.buyCryptoFiat'; + : this.amlCheck !== AmlCheck.PENDING && this.amlCheck !== AmlCheck.FAIL + ? 'mail.payment.deposit.buyCryptoFiat' + : this.amlReason === AmlReason.DAILY_LIMIT + ? 'mail.payment.pending.startKyc' + : this.amlReason === AmlReason.ANNUAL_LIMIT + ? 'mail.payment.pending.increaseLimit' + : this.amlCheck === AmlCheck.FAIL + ? 'mail.payment.deposit.paybackInitiated' + : null; } get user(): User { diff --git a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts index 80e11d531b..dfd57773ab 100644 --- a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts +++ b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts @@ -7,6 +7,7 @@ import { Util } from 'src/shared/util'; import { Blockchain, BlockchainExplorerUrls } from 'src/blockchain/shared/enums/blockchain.enum'; import { AmlCheck } from '../enums/aml-check.enum'; import { I18nService } from 'nestjs-i18n'; +import { AmlReason } from '../enums/aml-reason.enum'; @Injectable() export class BuyCryptoNotificationService { @@ -19,6 +20,7 @@ export class BuyCryptoNotificationService { async sendNotificationMails(): Promise { await this.buyCryptoConfirmed(); await this.paybackToAddressInitiated(); + await this.pendingBuyCrypto(); } async buyCryptoConfirmed(): Promise { @@ -120,7 +122,7 @@ export class BuyCryptoNotificationService { if (entity.user.userData.mail) { await this.mailService.sendTranslatedMail({ userData: entity.user.userData, - translationKey: 'mail.payment.deposit.paybackInitiated', + translationKey: entity.translationKey, params: { inputAmount: entity.inputAmount, inputAsset: entity.inputAsset, @@ -142,4 +144,52 @@ export class BuyCryptoNotificationService { } } } + + async pendingBuyCrypto(): Promise { + const entities = await this.buyCryptoRepo.find({ + where: { + mailSendDate: IsNull(), + outputAmount: IsNull(), + chargebackDate: IsNull(), + chargebackBankTx: IsNull(), + amlReason: Not(IsNull()), + amlCheck: AmlCheck.PENDING, + }, + relations: [ + 'buy', + 'buy.user', + 'buy.user.userData', + 'cryptoInput', + 'cryptoRoute', + 'cryptoRoute.user', + 'cryptoRoute.user.userData', + ], + }); + + entities.length > 0 && console.log(`Sending ${entities.length} 'payback to address' email(s)`); + + for (const entity of entities) { + if (entity.amlReason !== AmlReason.ANNUAL_LIMIT && entity.amlReason !== AmlReason.DAILY_LIMIT) continue; + try { + entity.confirmSentMail(); + + if (entity.user.userData.mail) { + await this.mailService.sendTranslatedMail({ + userData: entity.user.userData, + translationKey: entity.translationKey, + params: { + hashLink: `https://payment.dfx.swiss/kyc?code=${entity.user.userData.kycHash}`, + }, + }); + } + + await this.buyCryptoRepo.update( + { id: entity.id }, + { mailSendDate: entity.mailSendDate, recipientMail: entity.recipientMail }, + ); + } catch (e) { + console.error(e); + } + } + } } diff --git a/src/shared/i18n/de/mail.json b/src/shared/i18n/de/mail.json index 1317597f66..b32bf7801b 100644 --- a/src/shared/i18n/de/mail.json +++ b/src/shared/i18n/de/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "Du hast dein tägliches Volumenlimit überschritten", + "body": "
Bitte verifiziere dich, um dein Limit zu erhöhen.
Nach der vollständigen Verifizierung wird deine Transaktion weiter bearbeitet.
Limit erhöhen mit Verizfierung?
Klicke bitte hier um dich zu verifizieren.
Alternativ kannst du auch über die DFX App auf deiner Paymentseite
bei \"Dein Limit\" auf den roten Pfeil klicken
und die Verifizierung starten.
Herzlichen Dank für dein entgegengebrachtes Vertrauen
Dein freundliches DFX Team
Bitcoiners by heart ♥️
", + "title": "Tägliches Limit überschritten" + }, + "increaseLimit": { + "salutation": "Du hast dein jährliches Volumenlimit überschritten", + "body": "
Bitte beantrage daher ein neues Jahreslimit
Sobald das neue Limit genehmigt wurde,
wird deine Transaktion weiter bearbeitet.
Limit erhöhen?
In der DFX App per \"Staking\" die Paymentseite aufrufen.
Bei \"Dein Limit\" auf den roten Pfeil gehen und
ein neues gewünschtes Limit beantragen.
Fragen? - Kontaktiere bitte support@dfx.swiss
Herzlichen Dank für dein entgegengebrachtes Vertrauen
Dein freundliches DFX Team
Bitcoiners by heart ♥️
", + "title": "Jährliches Limit überschritten" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Deine Einzahlung wurde erfolgreich bearbeitet", diff --git a/src/shared/i18n/en/mail.json b/src/shared/i18n/en/mail.json index f308ff2f44..7593bd0d1b 100644 --- a/src/shared/i18n/en/mail.json +++ b/src/shared/i18n/en/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "You have exceeded your daily volume limit", + "body": "
Please verify yourself by KYC (know your customer) to increase your limit.
After a successful KYC we proceed with your transaction.
Increase the limit by KYC?
Click here to start the KYC process.
Alternatively, you can also use the DFX app on your payment page,
click on the red arrow next to \"Your limit\"
and start the verification.
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", + "title": "Daily limit exceeded" + }, + "increaseLimit": { + "salutation": "You have exceeded your yearly volume limit", + "body": "
Please apply for a new annual limit.
Once the new limit has been approved,
we proceed with your transaction.
Increase the limit?
Open the payment page via \"Staking\" in the DFX App.
Go to the red arrow under \"Your limit\" and
request a new desired limit.
Questions? - Please contact support@dfx.swiss
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", + "title": "Annual limit exceeded" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Your deposit has been successfully processed", diff --git a/src/shared/i18n/es/mail.json b/src/shared/i18n/es/mail.json index 2708d791a8..f495228e49 100644 --- a/src/shared/i18n/es/mail.json +++ b/src/shared/i18n/es/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "Has excedido el límite de volumen diario", + "body": "
Por favor, verificate a través de KYC (conoce a tu cliente) para incrementar tu límite.
Después de que pases el KYC empezaremos con tu transacción.
¿Quieres incrementar el límite a través del KYC?
Aprieta aquí para empezar el proceso KYC.
Alternativamente, puedes usar la app DFX en la página de pago,
apretar la flecha roja al lado de \"Tu límite\"
y empieza la verificación.
Muchas gracias por tu confianza
Tu Equipo DFX
Bitcoiners by heart ♥️
", + "title": "Límite diario excedido" + }, + "increaseLimit": { + "salutation": "Has excedido tu límite de volumen anual", + "body": "
Por favor, registra tu interés para un límite anual nuevo.
Una vez el nuevo límite anual de haya aprobado,
empezaremos con tu transacción.
¿Quieres incrementar el límite?
Abre la aplicación DFX a través de la página de pago en \"Staking\".
Ves a la flecha roja debajo de \"Tu límite\" y
pide un límite nuevo.
¿Alguna pregunta? Por favor ponte en contacto con support@dfx.swiss
Muchas gracias por tu confianza
Tu Equipo DFX
Bitcoiners by heart ♥️
", + "title": "Has excedido el límite anual" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Tu deposito se ha procesado satisfactoriamente", diff --git a/src/shared/i18n/fr/mail.json b/src/shared/i18n/fr/mail.json index 4a7ba11b80..bb8632f46e 100644 --- a/src/shared/i18n/fr/mail.json +++ b/src/shared/i18n/fr/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "Vous avez dépassé votre volume journalier", + "body": "
Veuillez vous faire vérifier par le KYC (know your customer) pour augmenter votre limite.
Nous traiterons votre transaction après la réussite du KYC.
Augmenter la limite par un KYC ?
Cliquer here pour commencer la procédure de KYC.
Autrement, vous pouvez aussi utiliser l'appli DFX sur votre page de paiement,
cliquer sur la flèche rouge en face de \"Votre limite\"
et commencer la vérification.
Merci beaucoup pour votre confiance
Votre équipe DFX
Bitcoiners by heart ♥️
", + "title": "Limite journalière dépassée" + }, + "increaseLimit": { + "salutation": "Vous avez dépassé votre volume annuel", + "body": "
Veuillez demander une nouvelle limite annuelle.
Nous traiterons votre transaction après
l'augmentation de votre limite.
Augmenter la limite ?
Ouvrez la page de paiement via le bouton \"Staking\" dans l'appli DFX.
Rendez-vous sur la flèche rouge sous \"Votre limite\" et
demandez une nouvelle limite.
Des questions ? Veuillez contacter support@dfx.swiss
Merci beaucoup pour votre confiance
Votre équipe DFX
Bitcoiners by heart ♥️
", + "title": "Limite annuelle dépassée" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Votre dépôt a été effectué avec succès", diff --git a/src/shared/i18n/it/mail.json b/src/shared/i18n/it/mail.json index 7c2f576704..306f6134c3 100644 --- a/src/shared/i18n/it/mail.json +++ b/src/shared/i18n/it/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "Hai superato il tuo limite di volume giornaliero", + "body": "
Per favore, completa la verifica KYC (conosci il tuo cliente) per incrementare il tuo limite.
Dopo una verifica KYC eseguita con successo procederemo con le tue transazioni.
Incrementare il limite con la KYC?
Clicca qui per avviare il processo di KYC.
Alternativamente, puoi anche usare l'app DFX nella tua pagina di pagamento,
cliccare sulla freccia rossa vicino a \"Il tuo limite\"
e avviare la verifica.
Grazie mille per la tua fiducia
Tuo DFX team
Bitcoiners by heart ♥️
", + "title": "Limite giornaliero superato" + }, + "increaseLimit": { + "salutation": "Hai superato il tuo limite di volume annuo", + "body": "
Per favore, richiedi un nuovo limite annuale.
Una volta che il nuovo limite è stato approvato,
procederemo con la tua transazione.
Aumentare il limite?
Apri la pagina di pagamento attraverso \"Staking\" nell'app DFX.
Vai sulla freccia rossa sotto \"Il tuo limite\" e
fai richiesta per un nuovo limite desiderato.
Domande? - Per favore, contatta support@dfx.swiss
Grazie mille per la tua fiducia
Tuo DFX team
Bitcoiners by heart ♥️
", + "title": "Limite annuale superato" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Il tuo deposito e' stato processato con successo", diff --git a/src/shared/i18n/pt/mail.json b/src/shared/i18n/pt/mail.json index f884b3da64..c1b8eb4d42 100644 --- a/src/shared/i18n/pt/mail.json +++ b/src/shared/i18n/pt/mail.json @@ -39,6 +39,18 @@ } }, "payment": { + "pending": { + "startKyc": { + "salutation": "You have exceeded your daily volume limit", + "body": "
Please verify yourself by KYC (know your customer) to increase your limit.
After a successful KYC we proceed with your transaction.
Increase the limit by KYC?
Click here to start the KYC process.
Alternatively, you can also use the DFX app on your payment page,
click on the red arrow next to \"Your limit\"
and start the verification.
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", + "title": "Daily limit exceeded" + }, + "increaseLimit": { + "salutation": "You have exceeded your yearly volume limit", + "body": "
Please apply for a new annual limit.
Once the new limit has been approved,
we proceed with your transaction.
Increase the limit?
Open the payment page via \"Staking\" in the DFX App.
Go to the red arrow under \"Your limit\" and
request a new desired limit.
Questions? - Please contact support@dfx.swiss
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", + "title": "Annual limit exceeded" + } + }, "deposit": { "buyCryptoFiat": { "salutation": "Your deposit has been successfully processed", From 2e96aed9a26dfccd3f6931ac797d73dcee99e5b5 Mon Sep 17 00:00:00 2001 From: Yannick1712 Date: Mon, 10 Oct 2022 14:10:49 +0200 Subject: [PATCH 2/5] [DEV-847] Refactoring 1 --- .../buy-crypto/entities/buy-crypto.entity.ts | 23 ++++++++++--------- .../buy-crypto-notification.service.ts | 2 +- src/shared/i18n/de/mail.json | 4 ++-- src/shared/i18n/en/mail.json | 4 ++-- src/shared/i18n/es/mail.json | 4 ++-- src/shared/i18n/fr/mail.json | 4 ++-- src/shared/i18n/it/mail.json | 4 ++-- src/shared/i18n/pt/mail.json | 4 ++-- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts index 5d4b640125..af5825aea7 100644 --- a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts +++ b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts @@ -196,17 +196,18 @@ export class BuyCrypto extends IEntity { } get translationKey(): string { - return this.inputReferenceAsset === this.outputReferenceAsset && this.amlCheck !== AmlCheck.PENDING - ? 'mail.payment.deposit.buyCryptoCrypto' - : this.amlCheck !== AmlCheck.PENDING && this.amlCheck !== AmlCheck.FAIL - ? 'mail.payment.deposit.buyCryptoFiat' - : this.amlReason === AmlReason.DAILY_LIMIT - ? 'mail.payment.pending.startKyc' - : this.amlReason === AmlReason.ANNUAL_LIMIT - ? 'mail.payment.pending.increaseLimit' - : this.amlCheck === AmlCheck.FAIL - ? 'mail.payment.deposit.paybackInitiated' - : null; + if (this.amlCheck === AmlCheck.PASS) { + return this.inputReferenceAsset === this.outputReferenceAsset + ? 'mail.payment.deposit.buyCryptoCrypto' + : 'mail.payment.deposit.buyCryptoFiat'; + } else if (this.amlCheck === AmlCheck.PENDING) { + if (this.amlReason === AmlReason.DAILY_LIMIT) return 'mail.payment.pending.dailyLimit'; + if (this.amlReason === AmlReason.ANNUAL_LIMIT) return 'mail.payment.pending.annualLimit'; + } else if (this.amlCheck === AmlCheck.FAIL) { + return 'mail.payment.deposit.paybackInitiated'; + } + + return null; } get user(): User { diff --git a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts index dfd57773ab..1748ed05c3 100644 --- a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts +++ b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts @@ -166,7 +166,7 @@ export class BuyCryptoNotificationService { ], }); - entities.length > 0 && console.log(`Sending ${entities.length} 'payback to address' email(s)`); + entities.length > 0 && console.log(`Sending ${entities.length} 'pending' email(s)`); for (const entity of entities) { if (entity.amlReason !== AmlReason.ANNUAL_LIMIT && entity.amlReason !== AmlReason.DAILY_LIMIT) continue; diff --git a/src/shared/i18n/de/mail.json b/src/shared/i18n/de/mail.json index b32bf7801b..068bb6c733 100644 --- a/src/shared/i18n/de/mail.json +++ b/src/shared/i18n/de/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "Du hast dein tägliches Volumenlimit überschritten", "body": "
Bitte verifiziere dich, um dein Limit zu erhöhen.
Nach der vollständigen Verifizierung wird deine Transaktion weiter bearbeitet.
Limit erhöhen mit Verizfierung?
Klicke bitte hier um dich zu verifizieren.
Alternativ kannst du auch über die DFX App auf deiner Paymentseite
bei \"Dein Limit\" auf den roten Pfeil klicken
und die Verifizierung starten.
Herzlichen Dank für dein entgegengebrachtes Vertrauen
Dein freundliches DFX Team
Bitcoiners by heart ♥️
", "title": "Tägliches Limit überschritten" }, - "increaseLimit": { + "annualLimit": { "salutation": "Du hast dein jährliches Volumenlimit überschritten", "body": "
Bitte beantrage daher ein neues Jahreslimit
Sobald das neue Limit genehmigt wurde,
wird deine Transaktion weiter bearbeitet.
Limit erhöhen?
In der DFX App per \"Staking\" die Paymentseite aufrufen.
Bei \"Dein Limit\" auf den roten Pfeil gehen und
ein neues gewünschtes Limit beantragen.
Fragen? - Kontaktiere bitte support@dfx.swiss
Herzlichen Dank für dein entgegengebrachtes Vertrauen
Dein freundliches DFX Team
Bitcoiners by heart ♥️
", "title": "Jährliches Limit überschritten" diff --git a/src/shared/i18n/en/mail.json b/src/shared/i18n/en/mail.json index 7593bd0d1b..43d7573eec 100644 --- a/src/shared/i18n/en/mail.json +++ b/src/shared/i18n/en/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "You have exceeded your daily volume limit", "body": "
Please verify yourself by KYC (know your customer) to increase your limit.
After a successful KYC we proceed with your transaction.
Increase the limit by KYC?
Click here to start the KYC process.
Alternatively, you can also use the DFX app on your payment page,
click on the red arrow next to \"Your limit\"
and start the verification.
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", "title": "Daily limit exceeded" }, - "increaseLimit": { + "annualLimit": { "salutation": "You have exceeded your yearly volume limit", "body": "
Please apply for a new annual limit.
Once the new limit has been approved,
we proceed with your transaction.
Increase the limit?
Open the payment page via \"Staking\" in the DFX App.
Go to the red arrow under \"Your limit\" and
request a new desired limit.
Questions? - Please contact support@dfx.swiss
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", "title": "Annual limit exceeded" diff --git a/src/shared/i18n/es/mail.json b/src/shared/i18n/es/mail.json index f495228e49..a9a27d29b7 100644 --- a/src/shared/i18n/es/mail.json +++ b/src/shared/i18n/es/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "Has excedido el límite de volumen diario", "body": "
Por favor, verificate a través de KYC (conoce a tu cliente) para incrementar tu límite.
Después de que pases el KYC empezaremos con tu transacción.
¿Quieres incrementar el límite a través del KYC?
Aprieta aquí para empezar el proceso KYC.
Alternativamente, puedes usar la app DFX en la página de pago,
apretar la flecha roja al lado de \"Tu límite\"
y empieza la verificación.
Muchas gracias por tu confianza
Tu Equipo DFX
Bitcoiners by heart ♥️
", "title": "Límite diario excedido" }, - "increaseLimit": { + "annualLimit": { "salutation": "Has excedido tu límite de volumen anual", "body": "
Por favor, registra tu interés para un límite anual nuevo.
Una vez el nuevo límite anual de haya aprobado,
empezaremos con tu transacción.
¿Quieres incrementar el límite?
Abre la aplicación DFX a través de la página de pago en \"Staking\".
Ves a la flecha roja debajo de \"Tu límite\" y
pide un límite nuevo.
¿Alguna pregunta? Por favor ponte en contacto con support@dfx.swiss
Muchas gracias por tu confianza
Tu Equipo DFX
Bitcoiners by heart ♥️
", "title": "Has excedido el límite anual" diff --git a/src/shared/i18n/fr/mail.json b/src/shared/i18n/fr/mail.json index bb8632f46e..eaac7c3b9c 100644 --- a/src/shared/i18n/fr/mail.json +++ b/src/shared/i18n/fr/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "Vous avez dépassé votre volume journalier", "body": "
Veuillez vous faire vérifier par le KYC (know your customer) pour augmenter votre limite.
Nous traiterons votre transaction après la réussite du KYC.
Augmenter la limite par un KYC ?
Cliquer here pour commencer la procédure de KYC.
Autrement, vous pouvez aussi utiliser l'appli DFX sur votre page de paiement,
cliquer sur la flèche rouge en face de \"Votre limite\"
et commencer la vérification.
Merci beaucoup pour votre confiance
Votre équipe DFX
Bitcoiners by heart ♥️
", "title": "Limite journalière dépassée" }, - "increaseLimit": { + "annualLimit": { "salutation": "Vous avez dépassé votre volume annuel", "body": "
Veuillez demander une nouvelle limite annuelle.
Nous traiterons votre transaction après
l'augmentation de votre limite.
Augmenter la limite ?
Ouvrez la page de paiement via le bouton \"Staking\" dans l'appli DFX.
Rendez-vous sur la flèche rouge sous \"Votre limite\" et
demandez une nouvelle limite.
Des questions ? Veuillez contacter support@dfx.swiss
Merci beaucoup pour votre confiance
Votre équipe DFX
Bitcoiners by heart ♥️
", "title": "Limite annuelle dépassée" diff --git a/src/shared/i18n/it/mail.json b/src/shared/i18n/it/mail.json index 306f6134c3..bee00779fa 100644 --- a/src/shared/i18n/it/mail.json +++ b/src/shared/i18n/it/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "Hai superato il tuo limite di volume giornaliero", "body": "
Per favore, completa la verifica KYC (conosci il tuo cliente) per incrementare il tuo limite.
Dopo una verifica KYC eseguita con successo procederemo con le tue transazioni.
Incrementare il limite con la KYC?
Clicca qui per avviare il processo di KYC.
Alternativamente, puoi anche usare l'app DFX nella tua pagina di pagamento,
cliccare sulla freccia rossa vicino a \"Il tuo limite\"
e avviare la verifica.
Grazie mille per la tua fiducia
Tuo DFX team
Bitcoiners by heart ♥️
", "title": "Limite giornaliero superato" }, - "increaseLimit": { + "annualLimit": { "salutation": "Hai superato il tuo limite di volume annuo", "body": "
Per favore, richiedi un nuovo limite annuale.
Una volta che il nuovo limite è stato approvato,
procederemo con la tua transazione.
Aumentare il limite?
Apri la pagina di pagamento attraverso \"Staking\" nell'app DFX.
Vai sulla freccia rossa sotto \"Il tuo limite\" e
fai richiesta per un nuovo limite desiderato.
Domande? - Per favore, contatta support@dfx.swiss
Grazie mille per la tua fiducia
Tuo DFX team
Bitcoiners by heart ♥️
", "title": "Limite annuale superato" diff --git a/src/shared/i18n/pt/mail.json b/src/shared/i18n/pt/mail.json index c1b8eb4d42..439b362176 100644 --- a/src/shared/i18n/pt/mail.json +++ b/src/shared/i18n/pt/mail.json @@ -40,12 +40,12 @@ }, "payment": { "pending": { - "startKyc": { + "dailyLimit": { "salutation": "You have exceeded your daily volume limit", "body": "
Please verify yourself by KYC (know your customer) to increase your limit.
After a successful KYC we proceed with your transaction.
Increase the limit by KYC?
Click here to start the KYC process.
Alternatively, you can also use the DFX app on your payment page,
click on the red arrow next to \"Your limit\"
and start the verification.
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", "title": "Daily limit exceeded" }, - "increaseLimit": { + "annualLimit": { "salutation": "You have exceeded your yearly volume limit", "body": "
Please apply for a new annual limit.
Once the new limit has been approved,
we proceed with your transaction.
Increase the limit?
Open the payment page via \"Staking\" in the DFX App.
Go to the red arrow under \"Your limit\" and
request a new desired limit.
Questions? - Please contact support@dfx.swiss
Thank you very much for your trust
Your DFX Team
Bitcoiners by heart ♥️
", "title": "Annual limit exceeded" From db9bcdbe4cdddf985ff59b4a8e9f6306966351e9 Mon Sep 17 00:00:00 2001 From: Yannick1712 Date: Mon, 10 Oct 2022 17:55:29 +0200 Subject: [PATCH 3/5] [DEV-847] Refactoring 2 --- .../models/buy-crypto/entities/buy-crypto.entity.ts | 2 +- .../services/buy-crypto-notification.service.ts | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts index 70a21e664b..77c830ea97 100644 --- a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts +++ b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts @@ -207,7 +207,7 @@ export class BuyCrypto extends IEntity { return 'mail.payment.deposit.paybackInitiated'; } - return null; + throw new Error('buyCrypto mail error: missing translationKey'); } get user(): User { diff --git a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts index 435e5f0c30..1f9318b6c5 100644 --- a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts +++ b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { MailService } from 'src/shared/services/mail.service'; -import { IsNull, Not } from 'typeorm'; +import { In, IsNull, Not } from 'typeorm'; import { BuyCryptoRepository } from '../repositories/buy-crypto.repository'; import { BuyCryptoBatchStatus } from '../entities/buy-crypto-batch.entity'; import { Util } from 'src/shared/util'; @@ -142,7 +142,7 @@ export class BuyCryptoNotificationService { outputAmount: IsNull(), chargebackDate: IsNull(), chargebackBankTx: IsNull(), - amlReason: Not(IsNull()), + amlReason: In([AmlReason.DAILY_LIMIT, AmlReason.ANNUAL_LIMIT]), amlCheck: AmlCheck.PENDING, }, relations: [ @@ -159,7 +159,6 @@ export class BuyCryptoNotificationService { entities.length > 0 && console.log(`Sending ${entities.length} 'pending' email(s)`); for (const entity of entities) { - if (entity.amlReason !== AmlReason.ANNUAL_LIMIT && entity.amlReason !== AmlReason.DAILY_LIMIT) continue; try { entity.confirmSentMail(); @@ -173,10 +172,7 @@ export class BuyCryptoNotificationService { }); } - await this.buyCryptoRepo.update( - { id: entity.id }, - { mailSendDate: entity.mailSendDate, recipientMail: entity.recipientMail }, - ); + await this.buyCryptoRepo.update(...entity.confirmSentMail()); } catch (e) { console.error(e); } From 82fda9975269f2881404f4535859d57a9dda39bd Mon Sep 17 00:00:00 2001 From: Yannick1712 Date: Tue, 11 Oct 2022 12:32:35 +0200 Subject: [PATCH 4/5] [DEV-847] Refactoring 3 --- src/payment/models/buy-crypto/entities/buy-crypto.entity.ts | 2 +- .../buy-crypto/services/buy-crypto-notification.service.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts index 77c830ea97..a29feb3489 100644 --- a/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts +++ b/src/payment/models/buy-crypto/entities/buy-crypto.entity.ts @@ -207,7 +207,7 @@ export class BuyCrypto extends IEntity { return 'mail.payment.deposit.paybackInitiated'; } - throw new Error('buyCrypto mail error: missing translationKey'); + throw new Error(`Tried to send a mail for BuyCrypto ${this.id} in invalid state`); } get user(): User { diff --git a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts index 1f9318b6c5..42505c962c 100644 --- a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts +++ b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts @@ -27,7 +27,6 @@ export class BuyCryptoNotificationService { try { const txOutput = await this.buyCryptoRepo.find({ where: { - recipientMail: IsNull(), mailSendDate: IsNull(), txId: Not(IsNull()), isComplete: true, From 62423650c0b6e257480cabdb523a3b5648a19b87 Mon Sep 17 00:00:00 2001 From: Yannick1712 Date: Tue, 11 Oct 2022 13:56:07 +0200 Subject: [PATCH 5/5] [DEV-847] remove unused code --- .../buy-crypto/services/buy-crypto-notification.service.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts index 42505c962c..df58beda13 100644 --- a/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts +++ b/src/payment/models/buy-crypto/services/buy-crypto-notification.service.ts @@ -159,8 +159,6 @@ export class BuyCryptoNotificationService { for (const entity of entities) { try { - entity.confirmSentMail(); - if (entity.user.userData.mail) { await this.mailService.sendTranslatedMail({ userData: entity.user.userData,