forked from feathersjs-ecosystem/feathers-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbalance-transactions.ts
39 lines (35 loc) · 1.18 KB
/
balance-transactions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type Stripe from "stripe";
import type { FindMethod, ParamsWithStripe, ParamsWithStripeQuery } from "../types";
import { BaseService } from "./base";
export interface IBalanceTransactionService {
_find: FindMethod<ParamsWithStripeQuery<Stripe.BalanceTransactionListParams>, Stripe.BalanceTransaction>;
_get: (id: string, params: ParamsWithStripe) => Promise<Stripe.BalanceTransaction>;
_create: never;
_update: never;
_patch: never;
_remove: never;
}
export class BalanceTransactionService
extends BaseService<IBalanceTransactionService>
implements IBalanceTransactionService
{
_get(id: string, params: ParamsWithStripe) {
let { stripe } = this.filterParams(params);
stripe = Object.assign({}, stripe);
if (id) {
stripe.stripeAccount = id;
}
return this.stripe.balanceTransactions.retrieve(undefined, stripe);
}
_find (params: ParamsWithStripeQuery<Stripe.BalanceTransactionListParams>) {
const filtered = this.filterParams(params);
return this.handlePaginate(
filtered,
this.stripe.balanceTransactions.list(filtered.query, filtered.stripe)
);
}
_create: never;
_update: never;
_patch: never;
_remove: never;
}