@fiatden/openpay 0.0.0-stage → 0.0.1
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/README.md +269 -2
- package/dist/analytics.test.d.ts +2 -0
- package/dist/analytics.test.d.ts.map +1 -0
- package/dist/analytics.test.js +184 -0
- package/dist/apps.test.d.ts +2 -0
- package/dist/apps.test.d.ts.map +1 -0
- package/dist/apps.test.js +92 -0
- package/dist/http.d.ts +22 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +56 -0
- package/dist/http.test.d.ts +2 -0
- package/dist/http.test.d.ts.map +1 -0
- package/dist/http.test.js +47 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +190 -0
- package/dist/resources/analytics.d.ts +215 -0
- package/dist/resources/analytics.d.ts.map +1 -0
- package/dist/resources/analytics.js +66 -0
- package/dist/resources/apiKeys.d.ts +22 -0
- package/dist/resources/apiKeys.d.ts.map +1 -0
- package/dist/resources/apiKeys.js +40 -0
- package/dist/resources/apps.d.ts +108 -0
- package/dist/resources/apps.d.ts.map +1 -0
- package/dist/resources/apps.js +32 -0
- package/dist/resources/auth.d.ts +71 -0
- package/dist/resources/auth.d.ts.map +1 -0
- package/dist/resources/auth.js +71 -0
- package/dist/resources/billing.d.ts +148 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +55 -0
- package/dist/resources/charges.d.ts +67 -0
- package/dist/resources/charges.d.ts.map +1 -0
- package/dist/resources/charges.js +103 -0
- package/dist/resources/checkout.d.ts +80 -0
- package/dist/resources/checkout.d.ts.map +1 -0
- package/dist/resources/checkout.js +36 -0
- package/dist/resources/coupons.d.ts +66 -0
- package/dist/resources/coupons.d.ts.map +1 -0
- package/dist/resources/coupons.js +39 -0
- package/dist/resources/currencies.d.ts +45 -0
- package/dist/resources/currencies.d.ts.map +1 -0
- package/dist/resources/currencies.js +48 -0
- package/dist/resources/customers.d.ts +135 -0
- package/dist/resources/customers.d.ts.map +1 -0
- package/dist/resources/customers.js +50 -0
- package/dist/resources/disputes.d.ts +48 -0
- package/dist/resources/disputes.d.ts.map +1 -0
- package/dist/resources/disputes.js +47 -0
- package/dist/resources/emailTemplates.d.ts +55 -0
- package/dist/resources/emailTemplates.d.ts.map +1 -0
- package/dist/resources/emailTemplates.js +49 -0
- package/dist/resources/fx.d.ts +34 -0
- package/dist/resources/fx.d.ts.map +1 -0
- package/dist/resources/fx.js +27 -0
- package/dist/resources/invoices.d.ts +32 -0
- package/dist/resources/invoices.d.ts.map +1 -0
- package/dist/resources/invoices.js +36 -0
- package/dist/resources/merchants.d.ts +77 -0
- package/dist/resources/merchants.d.ts.map +1 -0
- package/dist/resources/merchants.js +97 -0
- package/dist/resources/metering.d.ts +65 -0
- package/dist/resources/metering.d.ts.map +1 -0
- package/dist/resources/metering.js +36 -0
- package/dist/resources/paymentLinks.d.ts +45 -0
- package/dist/resources/paymentLinks.d.ts.map +1 -0
- package/dist/resources/paymentLinks.js +32 -0
- package/dist/resources/payouts.d.ts +49 -0
- package/dist/resources/payouts.d.ts.map +1 -0
- package/dist/resources/payouts.js +55 -0
- package/dist/resources/providers.d.ts +52 -0
- package/dist/resources/providers.d.ts.map +1 -0
- package/dist/resources/providers.js +38 -0
- package/dist/resources/reconciliation.d.ts +125 -0
- package/dist/resources/reconciliation.d.ts.map +1 -0
- package/dist/resources/reconciliation.js +50 -0
- package/dist/resources/referrals.d.ts +25 -0
- package/dist/resources/referrals.d.ts.map +1 -0
- package/dist/resources/referrals.js +16 -0
- package/dist/resources/riskReview.d.ts +96 -0
- package/dist/resources/riskReview.d.ts.map +1 -0
- package/dist/resources/riskReview.js +44 -0
- package/dist/resources/roles.d.ts +59 -0
- package/dist/resources/roles.d.ts.map +1 -0
- package/dist/resources/roles.js +42 -0
- package/dist/resources/subscriptions.d.ts +42 -0
- package/dist/resources/subscriptions.d.ts.map +1 -0
- package/dist/resources/subscriptions.js +61 -0
- package/dist/resources/totp.d.ts +36 -0
- package/dist/resources/totp.d.ts.map +1 -0
- package/dist/resources/totp.js +41 -0
- package/dist/resources/wallets.d.ts +124 -0
- package/dist/resources/wallets.d.ts.map +1 -0
- package/dist/resources/wallets.js +68 -0
- package/dist/resources/webhooks.d.ts +47 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +41 -0
- package/dist/types.d.ts +484 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/package.json +46 -4
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeteringResource = void 0;
|
|
4
|
+
class MeteringResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async record(metric_name, count, subscription_id, customer_id) {
|
|
10
|
+
return this.client.request('/v1/usage/record', {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: { metric_name, count: count || 1, subscription_id, customer_id },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async report(metric_name, period) {
|
|
16
|
+
return this.client.request('/v1/usage/report', {
|
|
17
|
+
params: { metric_name, period: period || 'day' },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async history(params) {
|
|
21
|
+
return this.client.request('/v1/usage/history', { params });
|
|
22
|
+
}
|
|
23
|
+
async createMeter(params) {
|
|
24
|
+
return this.client.request('/v1/meters', {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
body: params,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async listMeters() {
|
|
30
|
+
return this.client.request('/v1/meters');
|
|
31
|
+
}
|
|
32
|
+
async deactivateMeter(id) {
|
|
33
|
+
return this.client.request(`/v1/meters/${id}`, { method: 'DELETE' });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.MeteringResource = MeteringResource;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
import { Currency, ListResponse } from '../types';
|
|
3
|
+
export interface PaymentLinkCreateParams {
|
|
4
|
+
amount: number;
|
|
5
|
+
currency?: Currency;
|
|
6
|
+
description?: string;
|
|
7
|
+
success_url?: string;
|
|
8
|
+
cancel_url?: string;
|
|
9
|
+
max_payments?: number;
|
|
10
|
+
/** Optional key forwarded as the Idempotency-Key header. */
|
|
11
|
+
idempotency_key?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PaymentLink {
|
|
14
|
+
id: string;
|
|
15
|
+
merchant_id: string;
|
|
16
|
+
code: string;
|
|
17
|
+
amount: number;
|
|
18
|
+
currency: Currency;
|
|
19
|
+
description?: string;
|
|
20
|
+
success_url?: string;
|
|
21
|
+
cancel_url?: string;
|
|
22
|
+
is_active: boolean;
|
|
23
|
+
max_payments?: number;
|
|
24
|
+
payment_count: number;
|
|
25
|
+
total_collected: number;
|
|
26
|
+
payment_url: string;
|
|
27
|
+
created_at: string;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class PaymentLinksResource {
|
|
31
|
+
private client;
|
|
32
|
+
constructor(client: HttpClient);
|
|
33
|
+
/** Create a shareable payment link. Returns a payment_url customers can visit. */
|
|
34
|
+
create(params: PaymentLinkCreateParams): Promise<PaymentLink>;
|
|
35
|
+
/** List payment links (optionally filtered by active status). */
|
|
36
|
+
list(params?: {
|
|
37
|
+
is_active?: boolean;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): Promise<ListResponse<PaymentLink>>;
|
|
40
|
+
/** Get a single payment link by code. */
|
|
41
|
+
get(code: string): Promise<PaymentLink>;
|
|
42
|
+
/** Deactivate a payment link so it stops accepting payments. */
|
|
43
|
+
deactivate(code: string): Promise<PaymentLink>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=paymentLinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pa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AAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAIhG,yCAAyC;IACnC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI7C,gEAAgE;IAC1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAKrD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentLinksResource = void 0;
|
|
4
|
+
class PaymentLinksResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/** Create a shareable payment link. Returns a payment_url customers can visit. */
|
|
10
|
+
async create(params) {
|
|
11
|
+
return this.client.request('/v1/payment-links', {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: params,
|
|
14
|
+
idempotencyKey: params.idempotency_key,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** List payment links (optionally filtered by active status). */
|
|
18
|
+
async list(params) {
|
|
19
|
+
return this.client.request('/v1/payment-links', { params });
|
|
20
|
+
}
|
|
21
|
+
/** Get a single payment link by code. */
|
|
22
|
+
async get(code) {
|
|
23
|
+
return this.client.request(`/v1/payment-links/${code}`);
|
|
24
|
+
}
|
|
25
|
+
/** Deactivate a payment link so it stops accepting payments. */
|
|
26
|
+
async deactivate(code) {
|
|
27
|
+
return this.client.request(`/v1/payment-links/${code}`, {
|
|
28
|
+
method: 'PATCH',
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.PaymentLinksResource = PaymentLinksResource;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
import { PayoutCreateParams, Payout, ListResponse } from '../types';
|
|
3
|
+
export interface BulkPayoutRow {
|
|
4
|
+
merchant_id: string;
|
|
5
|
+
amount: number;
|
|
6
|
+
narration?: string;
|
|
7
|
+
bank_code?: string;
|
|
8
|
+
account_number?: string;
|
|
9
|
+
account_name?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface BulkPayoutResult {
|
|
12
|
+
summary: {
|
|
13
|
+
total: number;
|
|
14
|
+
created: number;
|
|
15
|
+
skipped: number;
|
|
16
|
+
};
|
|
17
|
+
results: Array<{
|
|
18
|
+
row: number;
|
|
19
|
+
status: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export declare class PayoutsResource {
|
|
25
|
+
private client;
|
|
26
|
+
constructor(client: HttpClient);
|
|
27
|
+
/** Request a payout (withdrawal) from a merchant wallet. */
|
|
28
|
+
create(params: PayoutCreateParams): Promise<Payout>;
|
|
29
|
+
/** Retrieve a payout by ID. */
|
|
30
|
+
retrieve(id: string): Promise<Payout>;
|
|
31
|
+
/** List payouts, optionally filtered by merchant or status. */
|
|
32
|
+
list(params?: {
|
|
33
|
+
merchant_id?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
}): Promise<ListResponse<Payout>>;
|
|
36
|
+
/** List scheduled (future-dated) payouts that haven't been processed yet. */
|
|
37
|
+
listScheduled(params?: {
|
|
38
|
+
merchant_id?: string;
|
|
39
|
+
}): Promise<ListResponse<Payout>>;
|
|
40
|
+
/** Create multiple payouts in a single batch (max 100 rows). */
|
|
41
|
+
createBulk(rows: BulkPayoutRow[], idempotencyKey?: string): Promise<BulkPayoutResult>;
|
|
42
|
+
/** List payouts awaiting admin approval (admin only). */
|
|
43
|
+
listAwaitingApproval(): Promise<ListResponse<Payout>>;
|
|
44
|
+
/** Approve an awaiting_approval payout and queue it for processing (admin only). */
|
|
45
|
+
approve(id: string): Promise<Payout>;
|
|
46
|
+
/** Reject an awaiting_approval payout, returning locked funds (admin only). */
|
|
47
|
+
reject(id: string, reason?: string): Promise<Payout>;
|
|
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AY,CAAC,MAAM,CAAC,CAAC;IAI7F,6EAA6E;IACvE,aAAa,CAAC,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAIrF,gEAAgE;IAC1D,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQ3F,yDAAyD;IACnD,oBAAoB,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAI3D,oFAAoF;IAC9E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM1C,+EAA+E;IACzE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM3D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PayoutsResource = void 0;
|
|
4
|
+
class PayoutsResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/** Request a payout (withdrawal) from a merchant wallet. */
|
|
10
|
+
async create(params) {
|
|
11
|
+
return this.client.request('/v1/payouts', {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: params,
|
|
14
|
+
idempotencyKey: params.idempotency_key,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** Retrieve a payout by ID. */
|
|
18
|
+
async retrieve(id) {
|
|
19
|
+
return this.client.request(`/v1/payouts/${id}`);
|
|
20
|
+
}
|
|
21
|
+
/** List payouts, optionally filtered by merchant or status. */
|
|
22
|
+
async list(params) {
|
|
23
|
+
return this.client.request('/v1/payouts', { params });
|
|
24
|
+
}
|
|
25
|
+
/** List scheduled (future-dated) payouts that haven't been processed yet. */
|
|
26
|
+
async listScheduled(params) {
|
|
27
|
+
return this.client.request('/v1/payouts/scheduled', { params });
|
|
28
|
+
}
|
|
29
|
+
/** Create multiple payouts in a single batch (max 100 rows). */
|
|
30
|
+
async createBulk(rows, idempotencyKey) {
|
|
31
|
+
return this.client.request('/v1/payouts/bulk', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: { rows },
|
|
34
|
+
idempotencyKey,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** List payouts awaiting admin approval (admin only). */
|
|
38
|
+
async listAwaitingApproval() {
|
|
39
|
+
return this.client.request('/v1/payouts/awaiting-approval');
|
|
40
|
+
}
|
|
41
|
+
/** Approve an awaiting_approval payout and queue it for processing (admin only). */
|
|
42
|
+
async approve(id) {
|
|
43
|
+
return this.client.request(`/v1/payouts/${encodeURIComponent(id)}/approve`, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Reject an awaiting_approval payout, returning locked funds (admin only). */
|
|
48
|
+
async reject(id, reason) {
|
|
49
|
+
return this.client.request(`/v1/payouts/${encodeURIComponent(id)}/reject`, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
body: reason ? { reason } : {},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.PayoutsResource = PayoutsResource;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
export interface ProviderConfig {
|
|
3
|
+
provider: string;
|
|
4
|
+
display_name: string | null;
|
|
5
|
+
is_active: boolean;
|
|
6
|
+
is_default: boolean;
|
|
7
|
+
created_at: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProvidersResource {
|
|
10
|
+
private client;
|
|
11
|
+
constructor(client: HttpClient);
|
|
12
|
+
listConfigs(): Promise<{
|
|
13
|
+
data: ProviderConfig[];
|
|
14
|
+
}>;
|
|
15
|
+
upsertConfig(params: {
|
|
16
|
+
provider: 'paystack' | 'flutterwave' | 'korapay' | 'hyperswitch';
|
|
17
|
+
secret_key: string;
|
|
18
|
+
public_key: string;
|
|
19
|
+
webhook_secret?: string;
|
|
20
|
+
display_name?: string;
|
|
21
|
+
settings?: Record<string, unknown>;
|
|
22
|
+
}): Promise<ProviderConfig>;
|
|
23
|
+
deleteConfig(provider: string): Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
getFees(): Promise<{
|
|
27
|
+
data: Record<string, {
|
|
28
|
+
percentage: number;
|
|
29
|
+
cap: number;
|
|
30
|
+
flatFee: number;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
/** Get the weighted-routing weights for each provider (admin only). */
|
|
34
|
+
getRouterWeights(): Promise<{
|
|
35
|
+
data: Array<{
|
|
36
|
+
provider: string;
|
|
37
|
+
weight: number;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
/** Update one or more weighted-routing weights (admin only). */
|
|
41
|
+
updateRouterWeights(params: {
|
|
42
|
+
weights?: Record<string, number>;
|
|
43
|
+
provider?: string;
|
|
44
|
+
weight?: number;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
data: Array<{
|
|
47
|
+
provider: string;
|
|
48
|
+
weight: number;
|
|
49
|
+
}>;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/resources/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;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EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CAM5K"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProvidersResource = void 0;
|
|
4
|
+
class ProvidersResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async listConfigs() {
|
|
10
|
+
return this.client.request('/v1/providers/config');
|
|
11
|
+
}
|
|
12
|
+
async upsertConfig(params) {
|
|
13
|
+
return this.client.request('/v1/providers/config', {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
body: params,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async deleteConfig(provider) {
|
|
19
|
+
return this.client.request(`/v1/providers/config/${provider}`, {
|
|
20
|
+
method: 'DELETE',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async getFees() {
|
|
24
|
+
return this.client.request('/v1/providers/fees');
|
|
25
|
+
}
|
|
26
|
+
/** Get the weighted-routing weights for each provider (admin only). */
|
|
27
|
+
async getRouterWeights() {
|
|
28
|
+
return this.client.request('/v1/providers/router-weights');
|
|
29
|
+
}
|
|
30
|
+
/** Update one or more weighted-routing weights (admin only). */
|
|
31
|
+
async updateRouterWeights(params) {
|
|
32
|
+
return this.client.request('/v1/providers/router-weights', {
|
|
33
|
+
method: 'PATCH',
|
|
34
|
+
body: params,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ProvidersResource = ProvidersResource;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
export interface ReconciliationReport {
|
|
3
|
+
id: string;
|
|
4
|
+
provider: string;
|
|
5
|
+
report_date: string;
|
|
6
|
+
filename?: string;
|
|
7
|
+
total_transactions: number;
|
|
8
|
+
total_amount: number;
|
|
9
|
+
total_fees: number;
|
|
10
|
+
matched_count: number;
|
|
11
|
+
mismatched_count: number;
|
|
12
|
+
missing_count: number;
|
|
13
|
+
status: 'processing' | 'completed' | 'failed';
|
|
14
|
+
created_at: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SettlementRecord {
|
|
17
|
+
id: string;
|
|
18
|
+
provider_reference?: string;
|
|
19
|
+
our_reference?: string;
|
|
20
|
+
amount?: number;
|
|
21
|
+
fee?: number;
|
|
22
|
+
settlement_amount?: number;
|
|
23
|
+
match_status: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UploadReportParams {
|
|
26
|
+
provider: 'paystack' | 'flutterwave' | 'korapay' | 'hyperswitch';
|
|
27
|
+
report_date: string;
|
|
28
|
+
filename?: string;
|
|
29
|
+
records: Array<{
|
|
30
|
+
provider_reference?: string;
|
|
31
|
+
amount?: number;
|
|
32
|
+
fee?: number;
|
|
33
|
+
settlement_amount?: number;
|
|
34
|
+
settlement_date?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export declare class ReconciliationResource {
|
|
38
|
+
private client;
|
|
39
|
+
constructor(client: HttpClient);
|
|
40
|
+
upload(params: UploadReportParams): Promise<{
|
|
41
|
+
report: ReconciliationReport;
|
|
42
|
+
message: string;
|
|
43
|
+
idempotent?: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
listReports(params?: {
|
|
46
|
+
provider?: string;
|
|
47
|
+
status?: string;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
data: ReconciliationReport[];
|
|
50
|
+
has_more: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
getReport(id: string): Promise<{
|
|
53
|
+
report: ReconciliationReport;
|
|
54
|
+
summary: Array<{
|
|
55
|
+
match_status: string;
|
|
56
|
+
count: number;
|
|
57
|
+
total_amount: number;
|
|
58
|
+
}>;
|
|
59
|
+
records: SettlementRecord[];
|
|
60
|
+
}>;
|
|
61
|
+
listRecords(params?: {
|
|
62
|
+
provider?: string;
|
|
63
|
+
match_status?: string;
|
|
64
|
+
limit?: number;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
data: SettlementRecord[];
|
|
67
|
+
has_more: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Synchronously re-run the matching pass on a report. Safe to call
|
|
71
|
+
* even if the row is in progress because processReconciliationReport
|
|
72
|
+
* is idempotent (insertRecords uses ON CONFLICT DO NOTHING; runMatching
|
|
73
|
+
* only updates). Returns the post-reprocess match counts.
|
|
74
|
+
*/
|
|
75
|
+
reprocess(id: string): Promise<{
|
|
76
|
+
message: string;
|
|
77
|
+
matched: number;
|
|
78
|
+
mismatched: number;
|
|
79
|
+
missing: number;
|
|
80
|
+
}>;
|
|
81
|
+
/** Get the reconciliation health summary for a date range. */
|
|
82
|
+
summary(params?: {
|
|
83
|
+
start_date?: string;
|
|
84
|
+
end_date?: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
period: {
|
|
87
|
+
start: string;
|
|
88
|
+
end: string;
|
|
89
|
+
};
|
|
90
|
+
summary: {
|
|
91
|
+
total_transactions: number;
|
|
92
|
+
reconciled: number;
|
|
93
|
+
pending: number;
|
|
94
|
+
mismatched: number;
|
|
95
|
+
disputed: number;
|
|
96
|
+
reconciliation_rate: number;
|
|
97
|
+
};
|
|
98
|
+
provider_breakdown: Array<{
|
|
99
|
+
provider: string;
|
|
100
|
+
total: number;
|
|
101
|
+
reconciled: number;
|
|
102
|
+
pending: number;
|
|
103
|
+
flagged: number;
|
|
104
|
+
}>;
|
|
105
|
+
}>;
|
|
106
|
+
/** List successful transactions that are not reconciled yet. */
|
|
107
|
+
listUnreconciled(params?: {
|
|
108
|
+
provider?: string;
|
|
109
|
+
limit?: number;
|
|
110
|
+
}): Promise<{
|
|
111
|
+
data: Array<SettlementRecord & {
|
|
112
|
+
reference?: string;
|
|
113
|
+
status?: string;
|
|
114
|
+
reconciliation_status?: string;
|
|
115
|
+
created_at?: string;
|
|
116
|
+
}>;
|
|
117
|
+
has_more: boolean;
|
|
118
|
+
}>;
|
|
119
|
+
/** Release an operator hold so the recovery worker can retry the report. */
|
|
120
|
+
clearOperatorHold(id: string): Promise<{
|
|
121
|
+
report: Record<string, unknown>;
|
|
122
|
+
message: string;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=reconciliation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconciliation.d.ts","sourceRoot":"","sources":["../../src/resources/reconciliation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,aAAa,CAAC;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CA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AAQ,EAAE,OAAO,CAAC;KACnB,CAAC;IAGF,4EAA4E;IACtE,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAKnG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReconciliationResource = void 0;
|
|
4
|
+
class ReconciliationResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async upload(params) {
|
|
10
|
+
return this.client.request('/v1/reconciliation/upload', {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async listReports(params) {
|
|
16
|
+
return this.client.request('/v1/reconciliation/reports', { params });
|
|
17
|
+
}
|
|
18
|
+
async getReport(id) {
|
|
19
|
+
return this.client.request(`/v1/reconciliation/reports/${id}`);
|
|
20
|
+
}
|
|
21
|
+
async listRecords(params) {
|
|
22
|
+
return this.client.request('/v1/reconciliation/records', { params });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Synchronously re-run the matching pass on a report. Safe to call
|
|
26
|
+
* even if the row is in progress because processReconciliationReport
|
|
27
|
+
* is idempotent (insertRecords uses ON CONFLICT DO NOTHING; runMatching
|
|
28
|
+
* only updates). Returns the post-reprocess match counts.
|
|
29
|
+
*/
|
|
30
|
+
async reprocess(id) {
|
|
31
|
+
return this.client.request(`/v1/reconciliation/reports/${id}/reprocess`, {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Get the reconciliation health summary for a date range. */
|
|
36
|
+
async summary(params) {
|
|
37
|
+
return this.client.request('/v1/reconciliation/summary', { params });
|
|
38
|
+
}
|
|
39
|
+
/** List successful transactions that are not reconciled yet. */
|
|
40
|
+
async listUnreconciled(params) {
|
|
41
|
+
return this.client.request('/v1/reconciliation/unreconciled', { params });
|
|
42
|
+
}
|
|
43
|
+
/** Release an operator hold so the recovery worker can retry the report. */
|
|
44
|
+
async clearOperatorHold(id) {
|
|
45
|
+
return this.client.request(`/v1/reconciliation/reports/${id}/clear-operator-hold`, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ReconciliationResource = ReconciliationResource;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
export interface Referral {
|
|
3
|
+
id: string;
|
|
4
|
+
referral_code: string;
|
|
5
|
+
commission_rate: number;
|
|
6
|
+
total_earned: number;
|
|
7
|
+
total_conversions: number;
|
|
8
|
+
status: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ReferralCommission {
|
|
11
|
+
id: string;
|
|
12
|
+
amount: number;
|
|
13
|
+
commission_amount: number;
|
|
14
|
+
status: string;
|
|
15
|
+
created_at: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class ReferralsResource {
|
|
18
|
+
private client;
|
|
19
|
+
constructor(client: HttpClient);
|
|
20
|
+
myReferral(): Promise<Referral>;
|
|
21
|
+
commissions(): Promise<{
|
|
22
|
+
data: ReferralCommission[];
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=referrals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referrals.d.ts","sourceRoot":"","sources":["../../src/resources/referrals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEhC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI/B,WAAW,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC;CAG7D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferralsResource = void 0;
|
|
4
|
+
class ReferralsResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
async myReferral() {
|
|
10
|
+
return this.client.request('/v1/merchants/me/referral');
|
|
11
|
+
}
|
|
12
|
+
async commissions() {
|
|
13
|
+
return this.client.request('/v1/merchants/me/referral/commissions');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ReferralsResource = ReferralsResource;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { HttpClient } from '../http';
|
|
2
|
+
import { Currency, Provider } from '../types';
|
|
3
|
+
export interface RiskReviewTransaction {
|
|
4
|
+
id: string;
|
|
5
|
+
reference: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
currency: Currency;
|
|
8
|
+
provider: Provider;
|
|
9
|
+
status: string;
|
|
10
|
+
customer_email: string;
|
|
11
|
+
customer_name: string | null;
|
|
12
|
+
channel: string | null;
|
|
13
|
+
risk_score: number;
|
|
14
|
+
risk_flags: Record<string, unknown>;
|
|
15
|
+
risk_review_status: 'flagged' | 'reviewing' | 'approved' | 'declined';
|
|
16
|
+
merchant_name: string | null;
|
|
17
|
+
created_at: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RiskReviewDetail {
|
|
20
|
+
transaction: RiskReviewTransaction & {
|
|
21
|
+
merchant_email: string;
|
|
22
|
+
merchant_id: string;
|
|
23
|
+
provider_reference: string | null;
|
|
24
|
+
fee: number;
|
|
25
|
+
net_amount: number;
|
|
26
|
+
};
|
|
27
|
+
reviews: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
transaction_id: string;
|
|
30
|
+
transaction_reference: string;
|
|
31
|
+
risk_score: number;
|
|
32
|
+
risk_flags: Record<string, unknown>;
|
|
33
|
+
reviewer_email: string;
|
|
34
|
+
action: 'flagged' | 'approved' | 'declined';
|
|
35
|
+
reason: string;
|
|
36
|
+
created_at: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface RiskReviewStats {
|
|
40
|
+
flagged: number;
|
|
41
|
+
reviewing: number;
|
|
42
|
+
approved_today: number;
|
|
43
|
+
declined_today: number;
|
|
44
|
+
avg_flagged_score: number;
|
|
45
|
+
max_flagged_score: number;
|
|
46
|
+
}
|
|
47
|
+
export interface RiskReviewListParams {
|
|
48
|
+
status?: 'flagged' | 'reviewing' | 'approved' | 'declined';
|
|
49
|
+
min_score?: number;
|
|
50
|
+
limit?: number;
|
|
51
|
+
offset?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface RiskReviewListResponse {
|
|
54
|
+
data: RiskReviewTransaction[];
|
|
55
|
+
total: number;
|
|
56
|
+
has_more: boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare class RiskReviewResource {
|
|
59
|
+
private client;
|
|
60
|
+
constructor(client: HttpClient);
|
|
61
|
+
/** List flagged transactions in the risk review queue (admin-only). */
|
|
62
|
+
list(params?: RiskReviewListParams): Promise<RiskReviewListResponse>;
|
|
63
|
+
/** Get full detail for a transaction, including review history. */
|
|
64
|
+
get(id: string): Promise<RiskReviewDetail>;
|
|
65
|
+
/** Approve a flagged transaction (admin-only). */
|
|
66
|
+
approve(id: string, reason?: string): Promise<{
|
|
67
|
+
transaction_id: string;
|
|
68
|
+
reference: string;
|
|
69
|
+
status: 'approved';
|
|
70
|
+
}>;
|
|
71
|
+
/** Decline a flagged transaction — also marks the transaction as failed. */
|
|
72
|
+
decline(id: string, reason?: string): Promise<{
|
|
73
|
+
transaction_id: string;
|
|
74
|
+
reference: string;
|
|
75
|
+
status: 'declined';
|
|
76
|
+
}>;
|
|
77
|
+
/** Get summary stats for the risk review queue. */
|
|
78
|
+
stats(): Promise<RiskReviewStats>;
|
|
79
|
+
/** Bulk approve up to 100 flagged transactions (admin). */
|
|
80
|
+
bulkApprove(ids: string[], reason?: string): Promise<{
|
|
81
|
+
approved: number;
|
|
82
|
+
results: Array<{
|
|
83
|
+
id: string;
|
|
84
|
+
status: string;
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
/** Bulk decline up to 100 flagged transactions (admin). Marks each as failed. */
|
|
88
|
+
bulkDecline(ids: string[], reason?: string): Promise<{
|
|
89
|
+
declined: number;
|
|
90
|
+
results: Array<{
|
|
91
|
+
id: string;
|
|
92
|
+
status: string;
|
|
93
|
+
}>;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=riskReview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"riskReview.d.ts","sourceRoot":"","sources":["../../src/resources/riskReview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;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