|
| 1 | +/** |
| 2 | + * @typedef {import('typeorm').MigrationInterface} MigrationInterface |
| 3 | + * @typedef {import('typeorm').QueryRunner} QueryRunner |
| 4 | + */ |
| 5 | + |
| 6 | +/** |
| 7 | + * Add manual bank transactions for Märki Baumann: |
| 8 | + * |
| 9 | + * 1. Interest charge (Sollzins) - DocID 42675306 |
| 10 | + * - Amount: CHF 1.11 (Debit) |
| 11 | + * - Date: 31.12.2025 |
| 12 | + * - Account: CH34 0857 3177 9752 0000 1 (CHF) |
| 13 | + * |
| 14 | + * 2. Payment return (Zahlungsrückweisung) - DocID 42675333 |
| 15 | + * - Amount: EUR 57'399.75 (Credit, net after EUR 28.71 fee) |
| 16 | + * - Date: 08.12.2025 |
| 17 | + * - Account: CH68 0857 3177 9752 0181 4 (EUR) |
| 18 | + * - Original payment to: Jelly Labs AG, Vaduz |
| 19 | + * - DFX Payment: 754427747 |
| 20 | + * |
| 21 | + * @class |
| 22 | + * @implements {MigrationInterface} |
| 23 | + */ |
| 24 | +module.exports = class AddManualBankTransactions1768817558924 { |
| 25 | + name = 'AddManualBankTransactions1768817558924' |
| 26 | + |
| 27 | + /** |
| 28 | + * @param {QueryRunner} queryRunner |
| 29 | + */ |
| 30 | + async up(queryRunner) { |
| 31 | + // === 1. Interest charge (Sollzins) === |
| 32 | + const existingInterest = await queryRunner.query(` |
| 33 | + SELECT "id" FROM "dbo"."bank_tx" |
| 34 | + WHERE "accountServiceRef" = '42675306' |
| 35 | + `); |
| 36 | + |
| 37 | + if (existingInterest.length > 0) { |
| 38 | + console.log('Bank transaction 42675306 (interest charge) already exists, skipping'); |
| 39 | + } else { |
| 40 | + await queryRunner.query(` |
| 41 | + INSERT INTO "dbo"."bank_tx" ( |
| 42 | + "accountServiceRef", |
| 43 | + "bookingDate", |
| 44 | + "valueDate", |
| 45 | + "amount", |
| 46 | + "currency", |
| 47 | + "creditDebitIndicator", |
| 48 | + "instructedAmount", |
| 49 | + "instructedCurrency", |
| 50 | + "txAmount", |
| 51 | + "txCurrency", |
| 52 | + "name", |
| 53 | + "accountIban", |
| 54 | + "remittanceInfo", |
| 55 | + "type" |
| 56 | + ) VALUES ( |
| 57 | + '42675306', |
| 58 | + '2025-12-31T00:00:00.000Z', |
| 59 | + '2025-12-31T00:00:00.000Z', |
| 60 | + 1.11, |
| 61 | + 'CHF', |
| 62 | + 'DBIT', |
| 63 | + 1.11, |
| 64 | + 'CHF', |
| 65 | + 1.11, |
| 66 | + 'CHF', |
| 67 | + 'Maerki Baumann & Co. AG', |
| 68 | + 'CH3408573177975200001', |
| 69 | + 'Sollzins', |
| 70 | + 'BankAccountFee' |
| 71 | + ) |
| 72 | + `); |
| 73 | + console.log('Inserted interest charge transaction 42675306'); |
| 74 | + } |
| 75 | + |
| 76 | + // === 2. Payment return (Zahlungsrückweisung) === |
| 77 | + const existingReturn = await queryRunner.query(` |
| 78 | + SELECT "id" FROM "dbo"."bank_tx" |
| 79 | + WHERE "accountServiceRef" = '42675333' |
| 80 | + `); |
| 81 | + |
| 82 | + if (existingReturn.length > 0) { |
| 83 | + console.log('Bank transaction 42675333 (payment return) already exists, skipping'); |
| 84 | + } else { |
| 85 | + await queryRunner.query(` |
| 86 | + INSERT INTO "dbo"."bank_tx" ( |
| 87 | + "accountServiceRef", |
| 88 | + "bookingDate", |
| 89 | + "valueDate", |
| 90 | + "amount", |
| 91 | + "currency", |
| 92 | + "creditDebitIndicator", |
| 93 | + "instructedAmount", |
| 94 | + "instructedCurrency", |
| 95 | + "txAmount", |
| 96 | + "txCurrency", |
| 97 | + "chargeAmount", |
| 98 | + "chargeCurrency", |
| 99 | + "name", |
| 100 | + "addressLine1", |
| 101 | + "country", |
| 102 | + "accountIban", |
| 103 | + "remittanceInfo", |
| 104 | + "type" |
| 105 | + ) VALUES ( |
| 106 | + '42675333', |
| 107 | + '2025-12-08T00:00:00.000Z', |
| 108 | + '2025-12-08T00:00:00.000Z', |
| 109 | + 57399.75, |
| 110 | + 'EUR', |
| 111 | + 'CRDT', |
| 112 | + 57428.46, |
| 113 | + 'EUR', |
| 114 | + 57399.75, |
| 115 | + 'EUR', |
| 116 | + 28.71, |
| 117 | + 'EUR', |
| 118 | + 'BADEN-WUERTTEMBERGISCHE BANK', |
| 119 | + 'STUTTGART', |
| 120 | + 'DE', |
| 121 | + 'CH6808573177975201814', |
| 122 | + 'Rueckverguetung Zahlung z.G. Jelly Labs AG - DFX Payment: 754427747', |
| 123 | + 'Pending' |
| 124 | + ) |
| 125 | + `); |
| 126 | + console.log('Inserted payment return transaction 42675333'); |
| 127 | + } |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * @param {QueryRunner} queryRunner |
| 132 | + */ |
| 133 | + async down(queryRunner) { |
| 134 | + await queryRunner.query(` |
| 135 | + DELETE FROM "dbo"."bank_tx" |
| 136 | + WHERE "accountServiceRef" IN ('42675306', '42675333') |
| 137 | + `); |
| 138 | + |
| 139 | + console.log('Deleted manual bank transactions 42675306, 42675333'); |
| 140 | + } |
| 141 | +} |
0 commit comments