Skip to content

Commit

Permalink
bank-import: Add amount in donation create bank object (#606)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sashko9807 authored Mar 10, 2024
1 parent cf32825 commit e60ec14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ describe('ImportTransactionsTask', () => {
billingName: 'JOHN DOE',
createdAt: new Date('2023-03-14T00:00:00.000Z'),
currency: 'BGN',
donations: { create: { personId: null, targetVaultId: 'vault-id', type: 'donation' } },
donations: {
create: { personId: null, amount: 5000, targetVaultId: 'vault-id', type: 'donation' },
},
extCustomerId: 'BG77UNCR92900016740920',
extPaymentIntentId:
'Booked_5954782144_70123543493054963FTRO23073A58G01C2023345440_20230314',
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/tasks/bank-import/import-transactions.task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ export class IrisTasks {
// Update status
trx.bankDonationStatus = BankDonationStatus.imported
} catch (e) {
Logger.error(e)
trx.bankDonationStatus = BankDonationStatus.importFailed
}
}
Expand Down Expand Up @@ -517,6 +518,7 @@ export class IrisTasks {
provider: PaymentProvider.bank,
donations: {
create: {
amount: bankTransaction.amount,
personId: null,
targetVaultId: vault.id,
type: DonationType.donation,
Expand Down

0 comments on commit e60ec14

Please sign in to comment.