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

[PAY-1975] Fix withdrawal email decimals #6261

Merged
merged 1 commit into from
Oct 6, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const email = ({
signature
}: {
name: string
amount: number
amount: string
wallet: string
signature: string
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class USDCPurchaseSeller extends BaseNotification<USDCPurchaseSellerRow>
notification: USDCPurchaseSellerRow
) {
super(dnDB, identityDB, notification)
const userIds: number[] = this.notification.user_ids!
this.amount = formatUSDCWeiToUSDString(
this.notification.data.amount.toString()
)
Expand Down Expand Up @@ -181,7 +180,9 @@ export class USDCPurchaseSeller extends BaseNotification<USDCPurchaseSellerRow>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ 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<NotificationRow, 'data'> & {
data: USDCWithdrawalNotification
}

export class USDCWithdrawal extends BaseNotification<USDCWithdrawalRow> {
userId: number
amount: number
amount: string
receiverAccount: string
signature: string

Expand All @@ -23,7 +24,9 @@ export class USDCWithdrawal extends BaseNotification<USDCWithdrawalRow> {
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) {
Expand Down