@adonis-agora/payments 1.0.0-rc.11 → 1.0.0-rc.13
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/CHANGELOG.md +17 -0
- package/dist/commands/main.d.ts +23 -3
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +39 -1
- package/dist/commands/main.js.map +1 -1
- package/dist/commands/payments_audit_list.d.ts +15 -0
- package/dist/commands/payments_audit_list.d.ts.map +1 -0
- package/dist/commands/payments_audit_list.js +55 -0
- package/dist/commands/payments_audit_list.js.map +1 -0
- package/dist/commands/payments_customers_list.d.ts +14 -0
- package/dist/commands/payments_customers_list.d.ts.map +1 -0
- package/dist/commands/payments_customers_list.js +50 -0
- package/dist/commands/payments_customers_list.js.map +1 -0
- package/dist/commands/payments_disputes_evidence.d.ts +20 -0
- package/dist/commands/payments_disputes_evidence.d.ts.map +1 -0
- package/dist/commands/payments_disputes_evidence.js +77 -0
- package/dist/commands/payments_disputes_evidence.js.map +1 -0
- package/dist/commands/payments_disputes_list.d.ts +16 -0
- package/dist/commands/payments_disputes_list.d.ts.map +1 -0
- package/dist/commands/payments_disputes_list.js +48 -0
- package/dist/commands/payments_disputes_list.js.map +1 -0
- package/dist/commands/payments_disputes_resolve.d.ts +15 -0
- package/dist/commands/payments_disputes_resolve.d.ts.map +1 -0
- package/dist/commands/payments_disputes_resolve.js +53 -0
- package/dist/commands/payments_disputes_resolve.js.map +1 -0
- package/dist/commands/payments_organizations_list.d.ts +11 -0
- package/dist/commands/payments_organizations_list.d.ts.map +1 -0
- package/dist/commands/payments_organizations_list.js +36 -0
- package/dist/commands/payments_organizations_list.js.map +1 -0
- package/dist/commands/payments_overview.d.ts +11 -0
- package/dist/commands/payments_overview.d.ts.map +1 -0
- package/dist/commands/payments_overview.js +48 -0
- package/dist/commands/payments_overview.js.map +1 -0
- package/dist/commands/payments_payments_list.d.ts +15 -0
- package/dist/commands/payments_payments_list.d.ts.map +1 -0
- package/dist/commands/payments_payments_list.js +62 -0
- package/dist/commands/payments_payments_list.js.map +1 -0
- package/dist/commands/payments_payments_refund.d.ts +14 -0
- package/dist/commands/payments_payments_refund.d.ts.map +1 -0
- package/dist/commands/payments_payments_refund.js +46 -0
- package/dist/commands/payments_payments_refund.js.map +1 -0
- package/dist/commands/payments_payments_show.d.ts +9 -0
- package/dist/commands/payments_payments_show.d.ts.map +1 -0
- package/dist/commands/payments_payments_show.js +67 -0
- package/dist/commands/payments_payments_show.js.map +1 -0
- package/dist/commands/payments_providers_list.d.ts +11 -0
- package/dist/commands/payments_providers_list.d.ts.map +1 -0
- package/dist/commands/payments_providers_list.js +35 -0
- package/dist/commands/payments_providers_list.js.map +1 -0
- package/dist/commands/payments_subscriptions_cancel.d.ts +14 -0
- package/dist/commands/payments_subscriptions_cancel.d.ts.map +1 -0
- package/dist/commands/payments_subscriptions_cancel.js +42 -0
- package/dist/commands/payments_subscriptions_cancel.js.map +1 -0
- package/dist/commands/payments_subscriptions_list.d.ts +13 -0
- package/dist/commands/payments_subscriptions_list.d.ts.map +1 -0
- package/dist/commands/payments_subscriptions_list.js +49 -0
- package/dist/commands/payments_subscriptions_list.js.map +1 -0
- package/dist/commands/payments_subscriptions_reprice.d.ts +16 -0
- package/dist/commands/payments_subscriptions_reprice.d.ts.map +1 -0
- package/dist/commands/payments_subscriptions_reprice.js +56 -0
- package/dist/commands/payments_subscriptions_reprice.js.map +1 -0
- package/dist/commands/payments_subscriptions_resume.d.ts +12 -0
- package/dist/commands/payments_subscriptions_resume.d.ts.map +1 -0
- package/dist/commands/payments_subscriptions_resume.js +31 -0
- package/dist/commands/payments_subscriptions_resume.js.map +1 -0
- package/dist/commands/payments_subscriptions_show.d.ts +9 -0
- package/dist/commands/payments_subscriptions_show.d.ts.map +1 -0
- package/dist/commands/payments_subscriptions_show.js +66 -0
- package/dist/commands/payments_subscriptions_show.js.map +1 -0
- package/dist/commands/payments_webhook_events_list.d.ts +13 -0
- package/dist/commands/payments_webhook_events_list.d.ts.map +1 -0
- package/dist/commands/payments_webhook_events_list.js +42 -0
- package/dist/commands/payments_webhook_events_list.js.map +1 -0
- package/dist/commands/payments_webhook_events_retry.d.ts +13 -0
- package/dist/commands/payments_webhook_events_retry.d.ts.map +1 -0
- package/dist/commands/payments_webhook_events_retry.js +34 -0
- package/dist/commands/payments_webhook_events_retry.js.map +1 -0
- package/dist/providers/dashboard_provider.d.ts +4 -16
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +32 -137
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/src/billing/billing_store.d.ts +8 -0
- package/dist/src/billing/billing_store.d.ts.map +1 -1
- package/dist/src/billing/billing_store.js +8 -0
- package/dist/src/billing/billing_store.js.map +1 -1
- package/dist/src/cli/console_command.d.ts +85 -0
- package/dist/src/cli/console_command.d.ts.map +1 -0
- package/dist/src/cli/console_command.js +265 -0
- package/dist/src/cli/console_command.js.map +1 -0
- package/dist/src/dashboard/actions.d.ts +45 -0
- package/dist/src/dashboard/actions.d.ts.map +1 -1
- package/dist/src/dashboard/actions.js +40 -1
- package/dist/src/dashboard/actions.js.map +1 -1
- package/dist/src/dashboard/api_core.d.ts +148 -0
- package/dist/src/dashboard/api_core.d.ts.map +1 -0
- package/dist/src/dashboard/api_core.js +172 -0
- package/dist/src/dashboard/api_core.js.map +1 -0
- package/dist/src/dashboard/console_shell.d.ts +8 -4
- package/dist/src/dashboard/console_shell.d.ts.map +1 -1
- package/dist/src/dashboard/console_shell.js +89 -31
- package/dist/src/dashboard/console_shell.js.map +1 -1
- package/dist/src/dashboard/dev_tools.d.ts.map +1 -1
- package/dist/src/dashboard/dev_tools.js +3 -16
- package/dist/src/dashboard/dev_tools.js.map +1 -1
- package/dist/src/dashboard/handlers.d.ts +53 -7
- package/dist/src/dashboard/handlers.d.ts.map +1 -1
- package/dist/src/dashboard/handlers.js +472 -10
- package/dist/src/dashboard/handlers.js.map +1 -1
- package/dist/src/dashboard/index.d.ts +6 -4
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +5 -3
- package/dist/src/dashboard/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tenantLabels, tenantOwnerTypes } from '../src/agora/tenancy.js';
|
|
2
|
+
import { CliError, PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
3
|
+
import { everyTenantId } from '../src/dashboard/api_core.js';
|
|
4
|
+
/**
|
|
5
|
+
* `node ace payments:organizations:list` — with organizations (tenancy) on, the organizations that
|
|
6
|
+
* own billing customers: the ids `--tenant` takes on the other `payments:*` commands.
|
|
7
|
+
*/
|
|
8
|
+
export default class PaymentsOrganizationsList extends PaymentsConsoleCommand {
|
|
9
|
+
static commandName = 'payments:organizations:list';
|
|
10
|
+
static description = 'List the organizations that own billing customers (the ids --tenant takes)';
|
|
11
|
+
async handle() {
|
|
12
|
+
if (this.tenant !== undefined) {
|
|
13
|
+
throw new CliError('`--tenant` narrows the other commands; this one lists the organizations.');
|
|
14
|
+
}
|
|
15
|
+
const tenancy = this.tenancy();
|
|
16
|
+
if (!tenancy.enabled) {
|
|
17
|
+
throw new CliError('Organizations (tenancy) are off in config/payments.ts.');
|
|
18
|
+
}
|
|
19
|
+
const ids = await everyTenantId(await this.store(), tenantOwnerTypes(tenancy));
|
|
20
|
+
const labels = await tenantLabels(ids);
|
|
21
|
+
const items = ids
|
|
22
|
+
.map((id) => ({ id, label: labels[id] ?? id }))
|
|
23
|
+
.sort((a, b) => a.label.localeCompare(b.label));
|
|
24
|
+
if (this.json)
|
|
25
|
+
return this.printJson({ data: items });
|
|
26
|
+
if (items.length === 0) {
|
|
27
|
+
this.logger.info('No organization owns a billing customer yet.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.printTable(items, [
|
|
31
|
+
['id', (r) => r.id],
|
|
32
|
+
['label', (r) => r.label],
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=payments_organizations_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_organizations_list.js","sourceRoot":"","sources":["../../commands/payments_organizations_list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,sBAAsB;IAC3E,MAAM,CAAU,WAAW,GAAG,6BAA6B,CAAC;IAC5D,MAAM,CAAU,WAAW,GACzB,4EAA4E,CAAC;IAErE,KAAK,CAAC,MAAM;QACpB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,QAAQ,CAChB,0EAA0E,CAC3E,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,QAAQ,CAAC,wDAAwD,CAAC,CAAC;QAC/E,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,GAAG;aACd,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAC9C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACrB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/** `node ace payments:overview` — the console's overview: revenue, active subscriptions, usage. */
|
|
3
|
+
export default class PaymentsOverview extends PaymentsConsoleCommand {
|
|
4
|
+
static commandName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
period?: string;
|
|
7
|
+
from?: string;
|
|
8
|
+
to?: string;
|
|
9
|
+
protected handle(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=payments_overview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_overview.d.ts","sourceRoot":"","sources":["../../commands/payments_overview.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAI9E,mGAAmG;AACnG,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,sBAAsB;IAClE,OAAgB,WAAW,SAAuB;IAClD,OAAgB,WAAW,SACyD;IAG5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,EAAE,CAAC,EAAE,MAAM,CAAC;IAEpB,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBtC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { money, PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
import { PERIOD_PRESETS } from '../src/dashboard/period.js';
|
|
11
|
+
/** `node ace payments:overview` — the console's overview: revenue, active subscriptions, usage. */
|
|
12
|
+
export default class PaymentsOverview extends PaymentsConsoleCommand {
|
|
13
|
+
static commandName = 'payments:overview';
|
|
14
|
+
static description = 'Billing metrics for a period: revenue, active subscriptions and usage per meter';
|
|
15
|
+
async handle() {
|
|
16
|
+
const query = {};
|
|
17
|
+
if (this.period !== undefined)
|
|
18
|
+
query.period = this.period;
|
|
19
|
+
if (this.from !== undefined)
|
|
20
|
+
query.from = this.from;
|
|
21
|
+
if (this.to !== undefined)
|
|
22
|
+
query.to = this.to;
|
|
23
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.overview, { query }));
|
|
24
|
+
if (this.json)
|
|
25
|
+
return this.printJson(body);
|
|
26
|
+
const period = body.period;
|
|
27
|
+
const metrics = body.metrics;
|
|
28
|
+
this.printFields([
|
|
29
|
+
['period', `${period.from} → ${period.to}${period.preset ? ` (${period.preset})` : ''}`],
|
|
30
|
+
]);
|
|
31
|
+
// Money lines are integer minor units ("(cents)" in the label); shown in the currency.
|
|
32
|
+
const isMoney = (key) => key === 'revenue' || key === 'net_revenue' || key === 'mrr';
|
|
33
|
+
this.printTable(metrics, [
|
|
34
|
+
['metric', (r) => String(r.label).replace(/ \(cents\)$/, '')],
|
|
35
|
+
['value', (r) => (isMoney(String(r.key)) ? money(r.value, body.currency) : r.value)],
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
__decorate([
|
|
40
|
+
flags.string({ description: `A preset window: ${PERIOD_PRESETS.join(', ')}` })
|
|
41
|
+
], PaymentsOverview.prototype, "period", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
flags.string({ description: 'Custom window start (ISO date)' })
|
|
44
|
+
], PaymentsOverview.prototype, "from", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
flags.string({ description: 'Custom window end (ISO date)' })
|
|
47
|
+
], PaymentsOverview.prototype, "to", void 0);
|
|
48
|
+
//# sourceMappingURL=payments_overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_overview.js","sourceRoot":"","sources":["../../commands/payments_overview.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,mGAAmG;AACnG,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,sBAAsB;IAClE,MAAM,CAAU,WAAW,GAAG,mBAAmB,CAAC;IAClD,MAAM,CAAU,WAAW,GACzB,iFAAiF,CAAC;IAW1E,KAAK,CA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,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SACrF,CAAC,CAAC;IACL,CAAC;CACF;AA3BS;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;gDACvD;AAGhB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;8CAC1C;AAGd;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;4CAC1C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/** `node ace payments:payments:list` — the console's payments list, newest first. */
|
|
3
|
+
export default class PaymentsPaymentsList extends PaymentsConsoleCommand {
|
|
4
|
+
static commandName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
reference?: string;
|
|
9
|
+
gatewayId?: string;
|
|
10
|
+
customerId?: string;
|
|
11
|
+
page?: number;
|
|
12
|
+
size?: number;
|
|
13
|
+
protected handle(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=payments_payments_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_list.d.ts","sourceRoot":"","sources":["../../commands/payments_payments_list.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG9E,qFAAqF;AACrF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,sBAAsB;IACtE,OAAgB,WAAW,SAA4B;IACvD,OAAgB,WAAW,SAAsE;IAGzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,IAAI,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBtC;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { money, PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
/** `node ace payments:payments:list` — the console's payments list, newest first. */
|
|
11
|
+
export default class PaymentsPaymentsList extends PaymentsConsoleCommand {
|
|
12
|
+
static commandName = 'payments:payments:list';
|
|
13
|
+
static description = 'List payments, newest first (exact lookups by reference and ids)';
|
|
14
|
+
async handle() {
|
|
15
|
+
const query = this.listQuery({
|
|
16
|
+
status: this.status,
|
|
17
|
+
provider: this.provider,
|
|
18
|
+
externalReference: this.reference,
|
|
19
|
+
gatewayId: this.gatewayId,
|
|
20
|
+
customerId: this.customerId,
|
|
21
|
+
}, { page: this.page, size: this.size });
|
|
22
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.payments, { query }));
|
|
23
|
+
this.printList(body, [
|
|
24
|
+
['gateway id', (r) => r.gatewayId],
|
|
25
|
+
['provider', (r) => r.provider],
|
|
26
|
+
['status', (r) => r.status],
|
|
27
|
+
['amount', (r) => money(r.amount, r.currency)],
|
|
28
|
+
['refunded', (r) => money(r.refundedAmount, r.currency)],
|
|
29
|
+
['reference', (r) => r.externalReference],
|
|
30
|
+
['owner', (r) => ownerLabel(r.owner)],
|
|
31
|
+
['created', (r) => r.createdAt],
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
flags.string({ description: 'Payment status (paid, pending, failed, refunded, disputed…)' })
|
|
37
|
+
], PaymentsPaymentsList.prototype, "status", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
flags.string({ description: 'Gateway name, e.g. stripe, asaas' })
|
|
40
|
+
], PaymentsPaymentsList.prototype, "provider", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
flags.string({ description: "The app's own reference (exact)" })
|
|
43
|
+
], PaymentsPaymentsList.prototype, "reference", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
flags.string({ description: 'Gateway payment id (exact)' })
|
|
46
|
+
], PaymentsPaymentsList.prototype, "gatewayId", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
flags.string({ description: 'Gateway customer id (exact)' })
|
|
49
|
+
], PaymentsPaymentsList.prototype, "customerId", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
flags.number({ description: 'Page number, 1-based' })
|
|
52
|
+
], PaymentsPaymentsList.prototype, "page", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
flags.number({ description: 'Rows per page (default 50, at most 200)' })
|
|
55
|
+
], PaymentsPaymentsList.prototype, "size", void 0);
|
|
56
|
+
function ownerLabel(owner) {
|
|
57
|
+
if (owner === null || typeof owner !== 'object')
|
|
58
|
+
return null;
|
|
59
|
+
const o = owner;
|
|
60
|
+
return o.email ?? (o.type !== null && o.id !== null ? `${o.type}:${o.id}` : null);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=payments_payments_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_list.js","sourceRoot":"","sources":["../../commands/payments_payments_list.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qFAAqF;AACrF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,sBAAsB;IACtE,MAAM,CAAU,WAAW,GAAG,wBAAwB,CAAC;IACvD,MAAM,CAAU,WAAW,GAAG,kEAAkE,CAAC;IAuBvF,KAAK,CAAC,MAAM;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAC1B;YACE,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,iBAAiB,EAAE,IAAI,CAAC,SAAS;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CACrC,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YACnB,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAA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AW,EAAE,yCAAyC,EAAE,CAAC;kDACnD;AA2BxB,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,CAAC,GAAG,KAAyE,CAAC;IACpF,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PaymentsActionCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/**
|
|
3
|
+
* `node ace payments:payments:refund <gatewayId> [--amount=<minor units>]` — refund a paid payment
|
|
4
|
+
* through the gateway that took it, exactly as the console's Refund button does. MOVES MONEY: asks
|
|
5
|
+
* for confirmation unless `--force`; `--dry-run` shows what would be refunded and sends nothing.
|
|
6
|
+
*/
|
|
7
|
+
export default class PaymentsPaymentsRefund extends PaymentsActionCommand {
|
|
8
|
+
static commandName: string;
|
|
9
|
+
static description: string;
|
|
10
|
+
gatewayId: string;
|
|
11
|
+
amount?: number;
|
|
12
|
+
protected handle(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=payments_payments_refund.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_refund.d.ts","sourceRoot":"","sources":["../../commands/payments_payments_refund.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,qBAAqB;IACvE,OAAgB,WAAW,SAA8B;IACzD,OAAgB,WAAW,SACuD;IAG1E,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,CAAC,EAAE,MAAM,CAAC;IAExB,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAwBtC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { args, flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { money, PaymentsActionCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
/**
|
|
11
|
+
* `node ace payments:payments:refund <gatewayId> [--amount=<minor units>]` — refund a paid payment
|
|
12
|
+
* through the gateway that took it, exactly as the console's Refund button does. MOVES MONEY: asks
|
|
13
|
+
* for confirmation unless `--force`; `--dry-run` shows what would be refunded and sends nothing.
|
|
14
|
+
*/
|
|
15
|
+
export default class PaymentsPaymentsRefund extends PaymentsActionCommand {
|
|
16
|
+
static commandName = 'payments:payments:refund';
|
|
17
|
+
static description = 'Refund a paid payment through its gateway (whole, or --amount in minor units)';
|
|
18
|
+
async handle() {
|
|
19
|
+
const req = {
|
|
20
|
+
params: { gatewayId: this.gatewayId },
|
|
21
|
+
body: { ...(this.amount !== undefined ? { amount: this.amount } : {}), ...this.noteBody() },
|
|
22
|
+
};
|
|
23
|
+
const preview = await this.preview(CONSOLE_ROUTES.refund, req, (dry) => {
|
|
24
|
+
const refund = dry.refund;
|
|
25
|
+
const payment = dry.payment;
|
|
26
|
+
return `Refund ${money(refund.amount, refund.currency)}${refund.partial ? ' (partial)' : ''} of payment ${this.gatewayId} through ${payment.provider}.`;
|
|
27
|
+
});
|
|
28
|
+
if (preview === null)
|
|
29
|
+
return;
|
|
30
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.refund, req));
|
|
31
|
+
if (this.json)
|
|
32
|
+
return this.printJson(body);
|
|
33
|
+
const refund = body.refund;
|
|
34
|
+
this.logger.success(`Refund ${refund.gatewayId} (${refund.status}): ${money(refund.amount, refund.currency)}`);
|
|
35
|
+
this.logger.info(String(body.note));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__decorate([
|
|
39
|
+
args.string({ description: 'Gateway payment id' })
|
|
40
|
+
], PaymentsPaymentsRefund.prototype, "gatewayId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
flags.number({
|
|
43
|
+
description: 'Partial refund in integer minor units (e.g. 1990 = 19.90). Omit for the full amount',
|
|
44
|
+
})
|
|
45
|
+
], PaymentsPaymentsRefund.prototype, "amount", void 0);
|
|
46
|
+
//# sourceMappingURL=payments_payments_refund.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_refund.js","sourceRoot":"","sources":["../../commands/payments_payments_refund.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,qBAAqB;IACvE,MAAM,CAAU,WAAW,GAAG,0BAA0B,CAAC;IACzD,MAAM,CAAU,WAAW,GACzB,+EAA+E,CAAC;IAWxE,KAAK,CAAC,MAAM;QACpB,MAAM,GAAG,GAAG;YACV,MAAM,EAAE,EAAE,SAAS,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AAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;CACF;AAjCS;IADP,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;yDACzB;AAMlB;IAJP,KAAK,CAAC,MAAM,CAAC;QACZ,WAAW,EACT,qFAAqF;KACxF,CAAC;sDACsB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/** `node ace payments:payments:show <gatewayId>` — one payment, as the console's detail shows it. */
|
|
3
|
+
export default class PaymentsPaymentsShow extends PaymentsConsoleCommand {
|
|
4
|
+
static commandName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
gatewayId: string;
|
|
7
|
+
protected handle(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=payments_payments_show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_show.d.ts","sourceRoot":"","sources":["../../commands/payments_payments_show.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG9E,qGAAqG;AACrG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,sBAAsB;IACtE,OAAgB,WAAW,SAA4B;IACvD,OAAgB,WAAW,SACiD;IAGpE,SAAS,EAAE,MAAM,CAAC;IAE1B,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAiDtC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { args } from '@adonisjs/core/ace';
|
|
8
|
+
import { money, PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
/** `node ace payments:payments:show <gatewayId>` — one payment, as the console's detail shows it. */
|
|
11
|
+
export default class PaymentsPaymentsShow extends PaymentsConsoleCommand {
|
|
12
|
+
static commandName = 'payments:payments:show';
|
|
13
|
+
static description = 'Show one payment: state, owner, disputes, webhook events and audit rows';
|
|
14
|
+
async handle() {
|
|
15
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.paymentDetail, { params: { gatewayId: this.gatewayId } }));
|
|
16
|
+
if (this.json)
|
|
17
|
+
return this.printJson(body);
|
|
18
|
+
const p = body.payment;
|
|
19
|
+
this.printFields([
|
|
20
|
+
['gateway id', p.gatewayId],
|
|
21
|
+
['provider', p.provider],
|
|
22
|
+
['status', p.status],
|
|
23
|
+
['amount', money(p.amount, p.currency)],
|
|
24
|
+
['refunded', money(p.refundedAmount, p.currency)],
|
|
25
|
+
['refundable', p.refundable],
|
|
26
|
+
['reference', p.externalReference],
|
|
27
|
+
['customer', p.customerId],
|
|
28
|
+
['subscription', p.subscriptionId],
|
|
29
|
+
['paid at', p.paidAt],
|
|
30
|
+
['created', p.createdAt],
|
|
31
|
+
]);
|
|
32
|
+
const disputes = body.disputes;
|
|
33
|
+
if (disputes.length > 0) {
|
|
34
|
+
this.logger.log('\nDisputes');
|
|
35
|
+
this.printTable(disputes, [
|
|
36
|
+
['gateway id', (r) => r.gatewayId],
|
|
37
|
+
['status', (r) => r.status],
|
|
38
|
+
['amount', (r) => money(r.amount, r.currency)],
|
|
39
|
+
['evidence due', (r) => r.evidenceDueBy],
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
const events = body.events.rows;
|
|
43
|
+
if (events.length > 0) {
|
|
44
|
+
this.logger.log('\nWebhook events');
|
|
45
|
+
this.printTable(events, [
|
|
46
|
+
['event id', (r) => r.gatewayEventId],
|
|
47
|
+
['type', (r) => r.type],
|
|
48
|
+
['status', (r) => r.status],
|
|
49
|
+
['created', (r) => r.createdAt],
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
const audit = body.audit;
|
|
53
|
+
if (audit.length > 0) {
|
|
54
|
+
this.logger.log('\nAudit');
|
|
55
|
+
this.printTable(audit, [
|
|
56
|
+
['action', (r) => r.action],
|
|
57
|
+
['actor', (r) => r.actor],
|
|
58
|
+
['amount', (r) => money(r.amount, r.currency)],
|
|
59
|
+
['at', (r) => r.createdAt],
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
args.string({ description: 'Gateway payment id' })
|
|
66
|
+
], PaymentsPaymentsShow.prototype, "gatewayId", void 0);
|
|
67
|
+
//# sourceMappingURL=payments_payments_show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_payments_show.js","sourceRoot":"","sources":["../../commands/payments_payments_show.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qGAAqG;AACrG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,sBAAsB;IACtE,MAAM,CAAU,WAAW,GAAG,wBAAwB,CAAC;IACvD,MAAM,CAAU,WAAW,GACzB,yEAAyE,CAAC;IAKlE,KAAK,CAAC,MAAM;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CACtB,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,E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AAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAC9C,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;aAC3B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AApDS;IADP,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;uDACzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/**
|
|
3
|
+
* `node ace payments:providers:list` — the gateways this install has data for or configures, and
|
|
4
|
+
* what each can do (refunds, disputes, subscription cancel/re-price at the gateway).
|
|
5
|
+
*/
|
|
6
|
+
export default class PaymentsProvidersList extends PaymentsConsoleCommand {
|
|
7
|
+
static commandName: string;
|
|
8
|
+
static description: string;
|
|
9
|
+
protected handle(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=payments_providers_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_providers_list.d.ts","sourceRoot":"","sources":["../../commands/payments_providers_list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,sBAAsB;IACvE,OAAgB,WAAW,SAA6B;IACxD,OAAgB,WAAW,SACoE;IAE/F,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAyBtC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
3
|
+
/**
|
|
4
|
+
* `node ace payments:providers:list` — the gateways this install has data for or configures, and
|
|
5
|
+
* what each can do (refunds, disputes, subscription cancel/re-price at the gateway).
|
|
6
|
+
*/
|
|
7
|
+
export default class PaymentsProvidersList extends PaymentsConsoleCommand {
|
|
8
|
+
static commandName = 'payments:providers:list';
|
|
9
|
+
static description = 'List the gateways in use and what each can do (refunds, disputes, subscription operations)';
|
|
10
|
+
async handle() {
|
|
11
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.providers, {}));
|
|
12
|
+
if (this.json)
|
|
13
|
+
return this.printJson(body);
|
|
14
|
+
const capabilities = body.capabilities;
|
|
15
|
+
const names = [
|
|
16
|
+
...new Set([...body.providers, ...Object.keys(capabilities)]),
|
|
17
|
+
].sort();
|
|
18
|
+
if (names.length === 0) {
|
|
19
|
+
this.logger.info('No gateways configured and no billing data yet.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const flag = (value) => value === undefined ? 'not configured' : value ? 'yes' : 'no';
|
|
23
|
+
this.printTable(names.map((name) => ({ name, ...(capabilities[name] ?? {}) })), [
|
|
24
|
+
['provider', (r) => r.name],
|
|
25
|
+
['refunds', (r) => flag(r.refunds)],
|
|
26
|
+
['disputes', (r) => flag(r.disputes)],
|
|
27
|
+
['gateway cancel', (r) => flag(r.cancelSubscription)],
|
|
28
|
+
['gateway re-price', (r) => flag(r.updateSubscription)],
|
|
29
|
+
]);
|
|
30
|
+
const types = body.eventTypes;
|
|
31
|
+
if (types.length > 0)
|
|
32
|
+
this.logger.log(`event types seen: ${types.join(', ')}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=payments_providers_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_providers_list.js","sourceRoot":"","sources":["../../commands/payments_providers_list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;GAGG;AACH,MAAM,CAAC,OA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,CAAC,CAAC,OAA8B,CAAC,CAAC;YAC1D,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,QAA+B,CAAC,CAAC;YAC5D,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAyC,CAAC,CAAC;YAC5E,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAyC,CAAC,CAAC;SAC/E,CACF,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,UAAsB,CAAC;QAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qBAAqB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PaymentsActionCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/**
|
|
3
|
+
* `node ace payments:subscriptions:cancel <id> [--now]` — cancel a running subscription at the end
|
|
4
|
+
* of its paid period (default) or immediately, through the gateway that owns it or, for a managed
|
|
5
|
+
* one, in this store. Asks for confirmation unless `--force`; `--dry-run` changes nothing.
|
|
6
|
+
*/
|
|
7
|
+
export default class PaymentsSubscriptionsCancel extends PaymentsActionCommand {
|
|
8
|
+
static commandName: string;
|
|
9
|
+
static description: string;
|
|
10
|
+
id: string;
|
|
11
|
+
now?: boolean;
|
|
12
|
+
protected handle(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=payments_subscriptions_cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_subscriptions_cancel.d.ts","sourceRoot":"","sources":["../../commands/payments_subscriptions_cancel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,qBAAqB;IAC5E,OAAgB,WAAW,SAAmC;IAC9D,OAAgB,WAAW,SACwE;IAG3F,EAAE,EAAE,MAAM,CAAC;IAGX,GAAG,CAAC,EAAE,OAAO,CAAC;IAEtB,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAiBtC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { args, flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { PaymentsActionCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
/**
|
|
11
|
+
* `node ace payments:subscriptions:cancel <id> [--now]` — cancel a running subscription at the end
|
|
12
|
+
* of its paid period (default) or immediately, through the gateway that owns it or, for a managed
|
|
13
|
+
* one, in this store. Asks for confirmation unless `--force`; `--dry-run` changes nothing.
|
|
14
|
+
*/
|
|
15
|
+
export default class PaymentsSubscriptionsCancel extends PaymentsActionCommand {
|
|
16
|
+
static commandName = 'payments:subscriptions:cancel';
|
|
17
|
+
static description = 'Cancel a subscription at the period end (default) or --now, through its gateway or managed row';
|
|
18
|
+
async handle() {
|
|
19
|
+
const req = {
|
|
20
|
+
params: { id: this.id },
|
|
21
|
+
body: { atPeriodEnd: this.now !== true, ...this.noteBody() },
|
|
22
|
+
};
|
|
23
|
+
const preview = await this.preview(CONSOLE_ROUTES.cancelSubscription, req, (dry) => {
|
|
24
|
+
const s = dry.subscription;
|
|
25
|
+
return `Cancel ${s.managed ? 'managed' : `${s.provider}`} subscription ${s.id} ${this.now === true ? 'NOW' : 'at the end of the paid period'}.`;
|
|
26
|
+
});
|
|
27
|
+
if (preview === null)
|
|
28
|
+
return;
|
|
29
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.cancelSubscription, req));
|
|
30
|
+
if (this.json)
|
|
31
|
+
return this.printJson(body);
|
|
32
|
+
this.logger.success(`Subscription ${this.id} ${this.now === true ? 'canceled' : 'set to cancel at the period end'}.`);
|
|
33
|
+
this.logger.info(String(body.note));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
__decorate([
|
|
37
|
+
args.string({ description: 'Subscription id or gateway subscription id' })
|
|
38
|
+
], PaymentsSubscriptionsCancel.prototype, "id", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
flags.boolean({ description: 'End it now instead of at the end of the paid period' })
|
|
41
|
+
], PaymentsSubscriptionsCancel.prototype, "now", void 0);
|
|
42
|
+
//# sourceMappingURL=payments_subscriptions_cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_subscriptions_cancel.js","sourceRoot":"","sources":["../../commands/payments_subscriptions_cancel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,qBAAqB;IAC5E,MAAM,CAAU,WAAW,GAAG,+BAA+B,CAAC;IAC9D,MAAM,CAAU,WAAW,GACzB,gGAAgG,CAAC;IAQzF,KAAK,CAAC,MAA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AAE,CAAC;uDACxD;AAGX;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;wDAChE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/** `node ace payments:subscriptions:list` — the console's subscriptions list, newest first. */
|
|
3
|
+
export default class PaymentsSubscriptionsList extends PaymentsConsoleCommand {
|
|
4
|
+
static commandName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
provider?: string;
|
|
8
|
+
customerId?: string;
|
|
9
|
+
page?: number;
|
|
10
|
+
size?: number;
|
|
11
|
+
protected handle(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=payments_subscriptions_list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_subscriptions_list.d.ts","sourceRoot":"","sources":["../../commands/payments_subscriptions_list.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG9E,+FAA+F;AAC/F,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,sBAAsB;IAC3E,OAAgB,WAAW,SAAiC;IAC5D,OAAgB,WAAW,SACwD;IAG3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,IAAI,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBtC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { flags } from '@adonisjs/core/ace';
|
|
8
|
+
import { money, PaymentsConsoleCommand } from '../src/cli/console_command.js';
|
|
9
|
+
import { CONSOLE_ROUTES } from '../src/dashboard/api_core.js';
|
|
10
|
+
/** `node ace payments:subscriptions:list` — the console's subscriptions list, newest first. */
|
|
11
|
+
export default class PaymentsSubscriptionsList extends PaymentsConsoleCommand {
|
|
12
|
+
static commandName = 'payments:subscriptions:list';
|
|
13
|
+
static description = 'List subscriptions, newest first, with the past_due and failing-renewal totals';
|
|
14
|
+
async handle() {
|
|
15
|
+
const query = this.listQuery({ status: this.status, provider: this.provider, customerId: this.customerId }, { page: this.page, size: this.size });
|
|
16
|
+
const body = this.bodyOf(await this.serve(CONSOLE_ROUTES.subscriptions, { query }));
|
|
17
|
+
this.printList(body, [
|
|
18
|
+
['id', (r) => r.id],
|
|
19
|
+
['gateway id', (r) => r.gatewayId],
|
|
20
|
+
['provider', (r) => r.provider],
|
|
21
|
+
['status', (r) => (r.cancelAtPeriodEnd === true ? `${r.status} (cancels)` : r.status)],
|
|
22
|
+
['plan', (r) => r.planId],
|
|
23
|
+
['amount', (r) => money(r.amount, r.currency)],
|
|
24
|
+
['cycle', (r) => r.cycle],
|
|
25
|
+
['next charge', (r) => r.nextChargeAt ?? r.currentPeriodEnd],
|
|
26
|
+
['renewal failures', (r) => r.renewalFailureCount],
|
|
27
|
+
]);
|
|
28
|
+
if (!this.json) {
|
|
29
|
+
const counts = body.counts;
|
|
30
|
+
this.logger.log(`past_due: ${counts.past_due} · failing renewals: ${counts.failing_renewals}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
__decorate([
|
|
35
|
+
flags.string({ description: 'Subscription status (past_due, paused, active, canceled…)' })
|
|
36
|
+
], PaymentsSubscriptionsList.prototype, "status", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
flags.string({ description: 'Gateway name, e.g. stripe, asaas' })
|
|
39
|
+
], PaymentsSubscriptionsList.prototype, "provider", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
flags.string({ description: 'Gateway customer id (exact)' })
|
|
42
|
+
], PaymentsSubscriptionsList.prototype, "customerId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
flags.number({ description: 'Page number, 1-based' })
|
|
45
|
+
], PaymentsSubscriptionsList.prototype, "page", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
flags.number({ description: 'Rows per page (default 50, at most 200)' })
|
|
48
|
+
], PaymentsSubscriptionsList.prototype, "size", void 0);
|
|
49
|
+
//# sourceMappingURL=payments_subscriptions_list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_subscriptions_list.js","sourceRoot":"","sources":["../../commands/payments_subscriptions_list.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,+FAA+F;AAC/F,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,sBAAsB;IAC3E,MAAM,CAAU,WAAW,GAAG,6BAA6B,CAAC;IAC5D,MAAM,CAAU,WAAW,GACzB,gFAAgF,CAAC;IAiBzE,KAAK,CAAC,MAAM;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAC1B,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAA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C,IAAI,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,IAAI,CAAC,MAAwD,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,aAAa,MAAM,CAAC,QAAQ,wBAAwB,MAAM,CAAC,gBAAgB,EAAE,CAC9E,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAtCS;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;yDACnE;AAGhB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;2DACxC;AAGlB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;6DACjC;AAGpB;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;uDAChC;AAGd;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;uDACnD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaymentsActionCommand } from '../src/cli/console_command.js';
|
|
2
|
+
/**
|
|
3
|
+
* `node ace payments:subscriptions:reprice <id> --amount=<minor units>` — change what a running
|
|
4
|
+
* subscription charges per cycle (managed: from the next cycle; gateway-owned: at the gateway).
|
|
5
|
+
* Changes future charges: asks for confirmation unless `--force`; `--dry-run` changes nothing.
|
|
6
|
+
*/
|
|
7
|
+
export default class PaymentsSubscriptionsReprice extends PaymentsActionCommand {
|
|
8
|
+
static commandName: string;
|
|
9
|
+
static description: string;
|
|
10
|
+
id: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
cycle?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
protected handle(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=payments_subscriptions_reprice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments_subscriptions_reprice.d.ts","sourceRoot":"","sources":["../../commands/payments_subscriptions_reprice.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,qBAAqB;IAC7E,OAAgB,WAAW,SAAoC;IAC/D,OAAgB,WAAW,SACgD;IAGnE,EAAE,EAAE,MAAM,CAAC;IAMX,MAAM,EAAE,MAAM,CAAC;IAGf,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,WAAW,CAAC,EAAE,MAAM,CAAC;IAE7B,UAAgB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAyBtC;CACF"}
|