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

feat: add additional details for card transactions #1876

Merged
merged 6 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -0,0 +1,23 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function (knex) {
return knex.schema.table('transactions', function (table) {
table.bigint('txAmount').nullable()
table.string('txCurrency').nullable()
table.string('conversionRate').nullable()
})
}

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function (knex) {
return knex.schema.table('transactions', function (table) {
table.dropColumn('txAmount')
table.dropColumn('txCurrency')
table.dropColumn('conversionRate')
})
}
3 changes: 3 additions & 0 deletions packages/wallet/backend/src/transaction/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export class Transaction
value!: bigint | null
walletAddress!: WalletAddress
isCard?: boolean
txAmount?: bigint
txCurrency?: string
conversionRate?: string

// Merchant name for card transactions
// Receiver or sender WA for ilp payments
Expand Down
6 changes: 6 additions & 0 deletions packages/wallet/backend/src/transaction/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ export class TransactionService implements ITransactionService {
status: 'COMPLETED',
description: '',
isCard: true,
secondParty: transaction.merchantName,
txAmount: transaction.transactionAmount
? transformBalance(Number(transaction.transactionAmount), 2)
: undefined,
conversionRate: transaction.mastercardConversion?.convRate,
txCurrency: transaction.transactionCurrency,
createdAt: new Date(transaction.createdAt)
})
)
Expand Down
4 changes: 4 additions & 0 deletions packages/wallet/shared/src/types/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export interface ICardTransaction {
wallet: number
transactionDateTime: string
processDateTime: string | null
merchantName?: string
mastercardConversion?: {
convRate?: string
}
}

export interface IPagination {
Expand Down
3 changes: 3 additions & 0 deletions packages/wallet/shared/src/types/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export interface TransactionResponse {
// Merchant name for card transactions
// Receiver or sender WA for ilp payments
secondParty?: string
txAmount?: bigint
txCurrency?: string
conversionRate?: string
createdAt: Date
updatedAt: Date
}
Expand Down
Loading