From 68b223bac944837fe3261d661042438cd3d380b1 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Thu, 5 Oct 2023 17:21:33 -0700 Subject: [PATCH] [PAY-1975] Fix withdrawal email decimals --- .../src/email/notifications/preRendered/withdrawal.ts | 2 +- .../src/processNotifications/mappers/usdcPurchaseSeller.ts | 5 +++-- .../src/processNotifications/mappers/usdcWithdrawal.ts | 7 +++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/discovery-provider/plugins/notifications/src/email/notifications/preRendered/withdrawal.ts b/discovery-provider/plugins/notifications/src/email/notifications/preRendered/withdrawal.ts index 1a5c3da5c80..45ed2962d37 100644 --- a/discovery-provider/plugins/notifications/src/email/notifications/preRendered/withdrawal.ts +++ b/discovery-provider/plugins/notifications/src/email/notifications/preRendered/withdrawal.ts @@ -5,7 +5,7 @@ export const email = ({ signature }: { name: string - amount: number + amount: string wallet: string signature: string }) => { diff --git a/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcPurchaseSeller.ts b/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcPurchaseSeller.ts index 6dcf42b0728..bce98c9d079 100644 --- a/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcPurchaseSeller.ts +++ b/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcPurchaseSeller.ts @@ -51,7 +51,6 @@ export class USDCPurchaseSeller extends BaseNotification notification: USDCPurchaseSellerRow ) { super(dnDB, identityDB, notification) - const userIds: number[] = this.notification.user_ids! this.amount = formatUSDCWeiToUSDString( this.notification.data.amount.toString() ) @@ -181,7 +180,9 @@ export class USDCPurchaseSeller extends BaseNotification artistName: sellerUsername, trackTitle: purchasedTrackName, trackLink: `${getHostname()}/${sellerHandle}/${track.slug}`, - trackImage: `${getContentNode()}/content/${track.cover_art_sizes}/480x480.jpg`, + trackImage: `${getContentNode()}/content/${ + track.cover_art_sizes + }/480x480.jpg`, price: this.amount, payExtra: this.extraAmount, total: this.totalAmount diff --git a/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcWithdrawal.ts b/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcWithdrawal.ts index 1f352529a71..8b8c888bdea 100644 --- a/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcWithdrawal.ts +++ b/discovery-provider/plugins/notifications/src/processNotifications/mappers/usdcWithdrawal.ts @@ -6,6 +6,7 @@ import { logger } from './../../logger' import { sendTransactionalEmail } from '../../email/notifications/sendEmail' import { buildUserNotificationSettings } from './userNotificationSettings' import { email } from '../../email/notifications/preRendered/withdrawal' +import { formatUSDCWeiToUSDString } from '../../utils/format' type USDCWithdrawalRow = Omit & { data: USDCWithdrawalNotification @@ -13,7 +14,7 @@ type USDCWithdrawalRow = Omit & { export class USDCWithdrawal extends BaseNotification { userId: number - amount: number + amount: string receiverAccount: string signature: string @@ -23,7 +24,9 @@ export class USDCWithdrawal extends BaseNotification { const userIds: number[] = this.notification.user_ids! this.userId = userIds[0] // Change is not an absolute value and for a transfer out will always be negative - this.amount = -1 * this.notification.data.change + this.amount = formatUSDCWeiToUSDString( + (-1 * this.notification.data.change).toString() + ) this.receiverAccount = this.notification.data.receiver_account this.signature = this.notification.data.signature } catch (e) {