@develit-services/ledger 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,9 +59,7 @@ const ENTRY_STATUSES = [
59
59
  ];
60
60
  const TRANSACTION_STATUSES = [
61
61
  "WAITING_FOR_PAYMENT",
62
- "WAITING_FOR_COLLATERAL",
63
- "COLLATERAL_PAID",
64
- "PAUSED",
62
+ // 'PAUSED',
65
63
  "WAITING_FOR_MANUAL_PROCESSING",
66
64
  "MATCHED",
67
65
  "RETURNING",
@@ -69,21 +67,22 @@ const TRANSACTION_STATUSES = [
69
67
  "FAILED",
70
68
  "CANCELLED",
71
69
  "SETTLED"
70
+ // not used for now, but maybe in future when we have settlement process implemented
72
71
  ];
73
72
  const TRANSACTION_TYPES = [
74
73
  "CLIENT_FUND_IN",
75
74
  "CLIENT_FUND_OUT",
76
75
  "PROVIDER_FUND_IN",
77
76
  "PROVIDER_FUND_OUT",
77
+ "COLLATERAL_FUND_IN",
78
+ "COLLATERAL_FUND_OUT",
78
79
  "EXCHANGE",
79
80
  // maybe in future
80
81
  "UNMATCHED",
81
82
  "ADJUSTMENT",
82
- // manual correction
83
+ // manual correction maybe in future
83
84
  "TRANSFER",
84
85
  // internal transfer between accounts
85
- "COLLATERAL",
86
- // forward collateral payment from client
87
86
  "REFUND"
88
87
  ];
89
88
  const REFERENCE_TYPES = [
@@ -94,8 +93,11 @@ const REFERENCE_TYPES = [
94
93
  "FORWARD",
95
94
  "TRANSACTION"
96
95
  ];
97
- const PAYMENT_CHARGE_TYPES = ["SHA", "OUR", "BEN"];
96
+ const CHARGE_BEARERS = ["SHA", "OUR", "BEN"];
98
97
  const PAYMENT_TYPES = ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
98
+ const REFUNDABLE_TRANSACTION_STATUSES = [
99
+ "WAITING_FOR_MANUAL_PROCESSING"
100
+ ];
99
101
 
100
102
  const ALLOWED_TRANSACTION_FILTERS = {
101
103
  CORRELATION_ID: "filterTransactionCorrelationId",
@@ -172,7 +174,7 @@ const transactionMetadataSchema = z.object({
172
174
  // zpráva pro příjemce
173
175
  type: z.enum(PAYMENT_TYPES),
174
176
  // typ platby
175
- paymentChargeType: z.enum(PAYMENT_CHARGE_TYPES).optional(),
177
+ chargeBearer: z.enum(CHARGE_BEARERS).optional(),
176
178
  expressPayment: z.boolean().optional(),
177
179
  reference: z.string().optional(),
178
180
  // další reference
@@ -311,6 +313,12 @@ const updateTransactionConfirmationSentAtInputSchema = z.object({
311
313
  transactionId: z.uuid()
312
314
  });
313
315
 
316
+ const refundTransactionInputSchema = z.object({
317
+ transactionId: z.uuid(),
318
+ amount: z.number().positive().optional(),
319
+ reason: z.string().min(1)
320
+ });
321
+
314
322
  const updateTransactionStatusInputSchema = z.object({
315
323
  transactionId: z.uuid(),
316
324
  status: z.enum(TRANSACTION_STATUSES),
@@ -319,4 +327,4 @@ const updateTransactionStatusInputSchema = z.object({
319
327
  completedAt: z.date().optional()
320
328
  });
321
329
 
322
- export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, COUNTRY_CODES as C, ENTRY_STATUSES as E, IDENTIFIER_KINDS as I, PAYMENT_CHARGE_TYPES as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ALLOWED_TRANSACTION_FILTERS as a, ASSET_TYPES as b, BATCH_STATUSES as c, PAYMENT_DIRECTIONS as d, PAYMENT_STATUSES as e, PAYMENT_TYPES as f, TRANSACTION_TYPES as g, cancelTransactionInputSchema as h, createAccountInputSchema as i, createTransactionInputSchema as j, deleteAccountInputSchema as k, failTransactionInputSchema as l, findAccountByIdentifierInputSchema as m, getAccountBalanceInputSchema as n, getAccountIdentifierInputSchema as o, getAccountInputSchema as p, getAccountsByOwnerInputSchema as q, getTransactionByIdInputSchema as r, getTransactionsByReferenceIdInputSchema as s, getTransactionsInputSchema as t, listAccountIdentifiersInputSchema as u, listAccountsInputSchema as v, matchTransactionInputSchema as w, updateAccountInputSchema as x, updateTransactionConfirmationSentAtInputSchema as y, updateTransactionStatusInputSchema as z };
330
+ export { ACCOUNT_TYPES as A, BALANCE_STRATEGIES as B, CHARGE_BEARERS as C, updateTransactionConfirmationSentAtInputSchema as D, ENTRY_STATUSES as E, updateTransactionStatusInputSchema as F, IDENTIFIER_KINDS as I, PAYMENT_DIRECTIONS as P, REFERENCE_TYPES as R, TRANSACTION_STATUSES as T, ALLOWED_TRANSACTION_FILTERS as a, ASSET_TYPES as b, BATCH_STATUSES as c, COUNTRY_CODES as d, PAYMENT_STATUSES as e, PAYMENT_TYPES as f, REFUNDABLE_TRANSACTION_STATUSES as g, TRANSACTION_TYPES as h, cancelTransactionInputSchema as i, createAccountInputSchema as j, createTransactionInputSchema as k, deleteAccountInputSchema as l, failTransactionInputSchema as m, findAccountByIdentifierInputSchema as n, getAccountBalanceInputSchema as o, getAccountIdentifierInputSchema as p, getAccountInputSchema as q, getAccountsByOwnerInputSchema as r, getTransactionByIdInputSchema as s, getTransactionsByReferenceIdInputSchema as t, getTransactionsInputSchema as u, listAccountIdentifiersInputSchema as v, listAccountsInputSchema as w, matchTransactionInputSchema as x, refundTransactionInputSchema as y, updateAccountInputSchema as z };
@@ -61,9 +61,7 @@ const ENTRY_STATUSES = [
61
61
  ];
62
62
  const TRANSACTION_STATUSES = [
63
63
  "WAITING_FOR_PAYMENT",
64
- "WAITING_FOR_COLLATERAL",
65
- "COLLATERAL_PAID",
66
- "PAUSED",
64
+ // 'PAUSED',
67
65
  "WAITING_FOR_MANUAL_PROCESSING",
68
66
  "MATCHED",
69
67
  "RETURNING",
@@ -71,21 +69,22 @@ const TRANSACTION_STATUSES = [
71
69
  "FAILED",
72
70
  "CANCELLED",
73
71
  "SETTLED"
72
+ // not used for now, but maybe in future when we have settlement process implemented
74
73
  ];
75
74
  const TRANSACTION_TYPES = [
76
75
  "CLIENT_FUND_IN",
77
76
  "CLIENT_FUND_OUT",
78
77
  "PROVIDER_FUND_IN",
79
78
  "PROVIDER_FUND_OUT",
79
+ "COLLATERAL_FUND_IN",
80
+ "COLLATERAL_FUND_OUT",
80
81
  "EXCHANGE",
81
82
  // maybe in future
82
83
  "UNMATCHED",
83
84
  "ADJUSTMENT",
84
- // manual correction
85
+ // manual correction maybe in future
85
86
  "TRANSFER",
86
87
  // internal transfer between accounts
87
- "COLLATERAL",
88
- // forward collateral payment from client
89
88
  "REFUND"
90
89
  ];
91
90
  const REFERENCE_TYPES = [
@@ -96,8 +95,11 @@ const REFERENCE_TYPES = [
96
95
  "FORWARD",
97
96
  "TRANSACTION"
98
97
  ];
99
- const PAYMENT_CHARGE_TYPES = ["SHA", "OUR", "BEN"];
98
+ const CHARGE_BEARERS = ["SHA", "OUR", "BEN"];
100
99
  const PAYMENT_TYPES = ["DOMESTIC", "SEPA", "SWIFT", "UNKNOWN"];
100
+ const REFUNDABLE_TRANSACTION_STATUSES = [
101
+ "WAITING_FOR_MANUAL_PROCESSING"
102
+ ];
101
103
 
102
104
  const ALLOWED_TRANSACTION_FILTERS = {
103
105
  CORRELATION_ID: "filterTransactionCorrelationId",
@@ -174,7 +176,7 @@ const transactionMetadataSchema = zod.z.object({
174
176
  // zpráva pro příjemce
175
177
  type: zod.z.enum(PAYMENT_TYPES),
176
178
  // typ platby
177
- paymentChargeType: zod.z.enum(PAYMENT_CHARGE_TYPES).optional(),
179
+ chargeBearer: zod.z.enum(CHARGE_BEARERS).optional(),
178
180
  expressPayment: zod.z.boolean().optional(),
179
181
  reference: zod.z.string().optional(),
180
182
  // další reference
@@ -313,6 +315,12 @@ const updateTransactionConfirmationSentAtInputSchema = zod.z.object({
313
315
  transactionId: zod.z.uuid()
314
316
  });
315
317
 
318
+ const refundTransactionInputSchema = zod.z.object({
319
+ transactionId: zod.z.uuid(),
320
+ amount: zod.z.number().positive().optional(),
321
+ reason: zod.z.string().min(1)
322
+ });
323
+
316
324
  const updateTransactionStatusInputSchema = zod.z.object({
317
325
  transactionId: zod.z.uuid(),
318
326
  status: zod.z.enum(TRANSACTION_STATUSES),
@@ -326,14 +334,15 @@ exports.ALLOWED_TRANSACTION_FILTERS = ALLOWED_TRANSACTION_FILTERS;
326
334
  exports.ASSET_TYPES = ASSET_TYPES;
327
335
  exports.BALANCE_STRATEGIES = BALANCE_STRATEGIES;
328
336
  exports.BATCH_STATUSES = BATCH_STATUSES;
337
+ exports.CHARGE_BEARERS = CHARGE_BEARERS;
329
338
  exports.COUNTRY_CODES = COUNTRY_CODES;
330
339
  exports.ENTRY_STATUSES = ENTRY_STATUSES;
331
340
  exports.IDENTIFIER_KINDS = IDENTIFIER_KINDS;
332
- exports.PAYMENT_CHARGE_TYPES = PAYMENT_CHARGE_TYPES;
333
341
  exports.PAYMENT_DIRECTIONS = PAYMENT_DIRECTIONS;
334
342
  exports.PAYMENT_STATUSES = PAYMENT_STATUSES;
335
343
  exports.PAYMENT_TYPES = PAYMENT_TYPES;
336
344
  exports.REFERENCE_TYPES = REFERENCE_TYPES;
345
+ exports.REFUNDABLE_TRANSACTION_STATUSES = REFUNDABLE_TRANSACTION_STATUSES;
337
346
  exports.TRANSACTION_STATUSES = TRANSACTION_STATUSES;
338
347
  exports.TRANSACTION_TYPES = TRANSACTION_TYPES;
339
348
  exports.cancelTransactionInputSchema = cancelTransactionInputSchema;
@@ -352,6 +361,7 @@ exports.getTransactionsInputSchema = getTransactionsInputSchema;
352
361
  exports.listAccountIdentifiersInputSchema = listAccountIdentifiersInputSchema;
353
362
  exports.listAccountsInputSchema = listAccountsInputSchema;
354
363
  exports.matchTransactionInputSchema = matchTransactionInputSchema;
364
+ exports.refundTransactionInputSchema = refundTransactionInputSchema;
355
365
  exports.updateAccountInputSchema = updateAccountInputSchema;
356
366
  exports.updateTransactionConfirmationSentAtInputSchema = updateTransactionConfirmationSentAtInputSchema;
357
367
  exports.updateTransactionStatusInputSchema = updateTransactionStatusInputSchema;