@@ -7,7 +7,7 @@ import { StripeWebhookType } from './validation'
77import { WalletAddressService } from '../walletAddress/service'
88import { AccountService } from '../account/service'
99import { Transaction } from '../transaction/model'
10- import { transformBalance } from '../utils/helpers'
10+ import { transformBalance , applyScale } from '../utils/helpers'
1111
1212export enum EventType {
1313 payment_intent_canceled = 'payment_intent.canceled' ,
@@ -49,7 +49,8 @@ export class StripeService implements IStripeService {
4949 const metadata = paymentIntent . metadata
5050 const receiving_address : string = metadata . receiving_address
5151 const currency : string = paymentIntent . currency
52- const amount : number = paymentIntent . amount
52+
53+ const scaledAmount = applyScale ( paymentIntent . amount )
5354
5455 try {
5556 const walletAddress =
@@ -63,7 +64,7 @@ export class StripeService implements IStripeService {
6364 await this . accountService . getGateHubWalletAddress ( walletAddress )
6465
6566 await this . gateHubClient . createTransaction ( {
66- amount,
67+ amount : scaledAmount ,
6768 vault_uuid : this . gateHubClient . getVaultUuid ( currency . toUpperCase ( ) ) ,
6869 receiving_address : gateHubWalletId ,
6970 sending_address : this . env . GATEHUB_SETTLEMENT_WALLET_ADDRESS ,
@@ -76,7 +77,7 @@ export class StripeService implements IStripeService {
7677 accountId : walletAddress . accountId ,
7778 paymentId : paymentIntent . id ,
7879 assetCode : currency . toUpperCase ( ) ,
79- value : transformBalance ( Number ( amount ) , 2 ) ,
80+ value : transformBalance ( scaledAmount , 2 ) ,
8081 type : 'INCOMING' ,
8182 status : 'COMPLETED' ,
8283 description : 'Stripe Payment' ,
0 commit comments