multivendor-wallet 0.0.2 → 0.0.3
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.
- package/dist/hooks/index.cjs +5 -25
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -25
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +5 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -568,31 +568,11 @@ function createRefundHooks(runtime) {
|
|
|
568
568
|
__name(createRefundHooks, "createRefundHooks");
|
|
569
569
|
|
|
570
570
|
// src/hooks/settlement.ts
|
|
571
|
-
function createSettlementHooks(
|
|
572
|
-
const { client, flags } = runtime;
|
|
571
|
+
function createSettlementHooks(_runtime) {
|
|
573
572
|
return {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
const txCtx = {
|
|
579
|
-
nativeTx: ctx.nativeTx
|
|
580
|
-
};
|
|
581
|
-
const amountPaise = toMinorUnit(ctx.amountRupees);
|
|
582
|
-
const vendorAccount = await client.getOrCreateAccount(WalletAccountType.VENDOR, ctx.vendorId, ctx.currency, txCtx);
|
|
583
|
-
const balance = await client.getBalance(vendorAccount.id, txCtx);
|
|
584
|
-
if (balance.available < amountPaise) {
|
|
585
|
-
throw new Error(`Insufficient vendor wallet balance for settlement (vendor ${ctx.vendorId})`);
|
|
586
|
-
}
|
|
587
|
-
await client.debit({
|
|
588
|
-
accountId: vendorAccount.id,
|
|
589
|
-
amount: amountPaise,
|
|
590
|
-
idempotencyKey: `settlement:${ctx.settlementId}:debit:${ctx.vendorId}`,
|
|
591
|
-
reference: {
|
|
592
|
-
referenceType: "settlement",
|
|
593
|
-
referenceId: String(ctx.settlementId)
|
|
594
|
-
}
|
|
595
|
-
}, txCtx);
|
|
573
|
+
/** @deprecated Settlement wallet debits removed — vendor payouts use wallet payout requests. */
|
|
574
|
+
async onSettlementDebit(_ctx) {
|
|
575
|
+
return;
|
|
596
576
|
}
|
|
597
577
|
};
|
|
598
578
|
}
|
|
@@ -1085,7 +1065,7 @@ __name(findCacheLedgerMismatches, "findCacheLedgerMismatches");
|
|
|
1085
1065
|
function createLifecycleHooks(runtime) {
|
|
1086
1066
|
return {
|
|
1087
1067
|
...createOrderHooks(runtime),
|
|
1088
|
-
...createSettlementHooks(
|
|
1068
|
+
...createSettlementHooks(),
|
|
1089
1069
|
...createRefundHooks(runtime)
|
|
1090
1070
|
};
|
|
1091
1071
|
}
|