Skip to content

Commit e60ec14

Browse files
authored
bank-import: Add amount in donation create bank object (#606)
* Donation table structural changes - Payment table will save the information regarding the payment - Donation table will save information regarding the donation(e.g. campaign, wish etc..) * Initial API changes for new payment structure * Adjust existing tests to cover the restructure * src/vault: Add possibility to decrement many vaults as well In future situations, we might need to decrement many vaults at once as well,(e.g. payment refund etc..) - Added some unit tests to cover vaults updates -Did some refactoring on commonly used types, as well as test mocks * schema.prisma: Rename Payments to Payment As the name of the model is used as a type, the acceptednaming convention is to name that type in singular way * Infer person.email as string in campaign.controller test cases Fixes TS related errors * src/bank-transactions: Check for admin privilleges regardless of env when simulating IRIS transactions * donations.service: Rename currentDonation to currentPayment in update fn * db/seed: Adapt seeding scripts to new structure * payment/seed: Use payment's createdAt updatedAt values for donation In production, the insertion is done within a single transaction, thus the dates should be the same * bank-import: Add amount in donation create bank object * import-transactions: Fix failing test case
1 parent cf32825 commit e60ec14

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

apps/api/src/tasks/bank-import/import-transactions.task.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ describe('ImportTransactionsTask', () => {
432432
billingName: 'JOHN DOE',
433433
createdAt: new Date('2023-03-14T00:00:00.000Z'),
434434
currency: 'BGN',
435-
donations: { create: { personId: null, targetVaultId: 'vault-id', type: 'donation' } },
435+
donations: {
436+
create: { personId: null, amount: 5000, targetVaultId: 'vault-id', type: 'donation' },
437+
},
436438
extCustomerId: 'BG77UNCR92900016740920',
437439
extPaymentIntentId:
438440
'Booked_5954782144_70123543493054963FTRO23073A58G01C2023345440_20230314',

apps/api/src/tasks/bank-import/import-transactions.task.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ export class IrisTasks {
454454
// Update status
455455
trx.bankDonationStatus = BankDonationStatus.imported
456456
} catch (e) {
457+
Logger.error(e)
457458
trx.bankDonationStatus = BankDonationStatus.importFailed
458459
}
459460
}
@@ -517,6 +518,7 @@ export class IrisTasks {
517518
provider: PaymentProvider.bank,
518519
donations: {
519520
create: {
521+
amount: bankTransaction.amount,
520522
personId: null,
521523
targetVaultId: vault.id,
522524
type: DonationType.donation,

0 commit comments

Comments
 (0)