payjp 2.1.4 → 2.2.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.
@@ -0,0 +1,9 @@
1
+ import Resource from './resource';
2
+ import * as I from './index';
3
+ export default class Balances extends Resource {
4
+ resource: string;
5
+ constructor(payjp: any);
6
+ list(query?: I.BalanceListOptions): Promise<I.List<I.Balance>>;
7
+ retrieve(id: string): Promise<I.Balance>;
8
+ statementUrls(id: string, query?: I.StatementUrlOptions): Promise<I.StatementUrl>;
9
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const resource_1 = require("./resource");
4
+ class Balances extends resource_1.default {
5
+ resource;
6
+ constructor(payjp) {
7
+ super(payjp);
8
+ this.resource = 'balances';
9
+ }
10
+ list(query = {}) {
11
+ return this.request('GET', this.resource, query);
12
+ }
13
+ retrieve(id) {
14
+ return this.request('GET', `${this.resource}/${id}`);
15
+ }
16
+ statementUrls(id, query = {}) {
17
+ return this.request('POST', `${this.resource}/${id}/statement_urls`, query);
18
+ }
19
+ }
20
+ exports.default = Balances;
package/built/index.d.ts CHANGED
@@ -9,6 +9,8 @@ import TenantTransfers from './tenantTransfers';
9
9
  import Tokens from './token';
10
10
  import Transfers from './transfer';
11
11
  import Statements from './statement';
12
+ import Terms from "./term";
13
+ import Balances from "./balance";
12
14
  declare namespace Payjp {
13
15
  export interface PayjpStatic {
14
16
  (apikey: string, options?: PayjpOptions): Payjp;
@@ -27,6 +29,8 @@ declare namespace Payjp {
27
29
  tenants: Tenants;
28
30
  tenant_transfers: TenantTransfers;
29
31
  statements: Statements;
32
+ terms: Terms;
33
+ balances: Balances;
30
34
  }
31
35
  export interface PayjpOptions {
32
36
  timeout?: number;
@@ -35,15 +39,18 @@ declare namespace Payjp {
35
39
  retryInitialDelay?: number;
36
40
  retryMaxDelay?: number;
37
41
  }
38
- export interface ListOptions {
42
+ export interface PaginationOptions {
39
43
  limit?: number;
40
44
  offset?: number;
45
+ }
46
+ export interface ListOptions extends PaginationOptions {
41
47
  since?: number;
42
48
  until?: number;
43
49
  }
44
50
  export interface ChargeListOptions extends TransferChargeListOptions {
45
51
  subscription?: string;
46
52
  tenant?: string;
53
+ term?: string;
47
54
  }
48
55
  export interface CustomerSubscriptionListOptions extends ListOptions {
49
56
  plan?: string;
@@ -69,6 +76,25 @@ declare namespace Payjp {
69
76
  transfer?: string;
70
77
  tenant?: string;
71
78
  }
79
+ export interface StatementListOptions extends ListOptions {
80
+ owner?: "merchant" | "tenant";
81
+ source_transfer?: string;
82
+ tenant?: string;
83
+ term?: string;
84
+ type?: "sales" | "service_fee" | "transfer_fee";
85
+ }
86
+ export interface TermListOptions extends PaginationOptions {
87
+ since_start_at?: number;
88
+ until_start_at?: number;
89
+ }
90
+ export interface BalanceListOptions extends ListOptions {
91
+ since_due_date?: number;
92
+ until_due_date?: number;
93
+ state?: "collecting" | "transfer" | "claim";
94
+ closed?: boolean;
95
+ owner?: "merchant" | "tenant";
96
+ tenant?: string;
97
+ }
72
98
  interface OptionsMetadata {
73
99
  [x: string]: string | number;
74
100
  }
@@ -204,6 +230,7 @@ declare namespace Payjp {
204
230
  tenant?: string | null;
205
231
  product?: any;
206
232
  three_d_secure_status: string | null;
233
+ term_id: string | null;
207
234
  }
208
235
  export interface Customer {
209
236
  object: "customer";
@@ -327,6 +354,7 @@ declare namespace Payjp {
327
354
  email: string;
328
355
  id: string;
329
356
  merchant: Merchant;
357
+ team_id: string;
330
358
  }
331
359
  export interface Merchant {
332
360
  object: "merchant";
@@ -371,7 +399,14 @@ declare namespace Payjp {
371
399
  id: string;
372
400
  livemode: boolean;
373
401
  object: "statement";
374
- items: List<StatementItems>;
402
+ title: string;
403
+ tenant_id: string;
404
+ type: "sales" | "service_fee" | "transfer_fee";
405
+ net: number;
406
+ term: Term | null;
407
+ balance_id: string;
408
+ items: StatementItems[];
409
+ updated: number;
375
410
  }
376
411
  export interface StatementItems {
377
412
  subject: "gross_sales" | "fee" | "platform_fee" | "gross_refund" | "refund_fee_offset" | "refund_platform_fee_offset" | "chargeback" | "chargeback_fee_offset" | "chargeback_platform_fee_offset" | "proplan" | "transfer_fee";
@@ -402,6 +437,37 @@ declare namespace Payjp {
402
437
  interface TenantTransferSummary extends Summary {
403
438
  total_platform_fee: number;
404
439
  }
440
+ export interface Term {
441
+ id: string;
442
+ livemode: boolean;
443
+ object: "term";
444
+ charge_count: number;
445
+ refund_count: number;
446
+ dispute_count: number;
447
+ end_at: number;
448
+ start_at: number;
449
+ }
450
+ export interface BankInfo {
451
+ bank_code: string;
452
+ bank_branch_code: string;
453
+ bank_account_type: string;
454
+ bank_account_number: string;
455
+ bank_account_holder_name: string;
456
+ bank_account_status: "success" | "failed" | "pending";
457
+ }
458
+ export interface Balance {
459
+ created: number;
460
+ id: string;
461
+ livemode: boolean;
462
+ net: number;
463
+ object: "balance";
464
+ state: "collecting" | "transfer" | "claim";
465
+ statements: Statement[];
466
+ closed: boolean;
467
+ due_date: null | number;
468
+ tenant_id: string;
469
+ bank_info: null | BankInfo;
470
+ }
405
471
  export interface Deleted {
406
472
  deleted: boolean;
407
473
  id: string;
package/built/index.js CHANGED
@@ -10,6 +10,8 @@ const tenantTransfers_1 = require("./tenantTransfers");
10
10
  const token_1 = require("./token");
11
11
  const transfer_1 = require("./transfer");
12
12
  const statement_1 = require("./statement");
13
+ const term_1 = require("./term");
14
+ const balance_1 = require("./balance");
13
15
  const Payjp = function (apikey, options = {}) {
14
16
  if (!apikey) {
15
17
  throw new Error('Please set apikey.');
@@ -42,6 +44,8 @@ const Payjp = function (apikey, options = {}) {
42
44
  tenants: new tenants_1.default(payjpConfig),
43
45
  'tenant_transfers': new tenantTransfers_1.default(payjpConfig),
44
46
  statements: new statement_1.default(payjpConfig),
47
+ terms: new term_1.default(payjpConfig),
48
+ balances: new balance_1.default(payjpConfig),
45
49
  };
46
50
  };
47
51
  module.exports = Payjp;
@@ -3,7 +3,7 @@ import * as I from './index';
3
3
  export default class Statements extends Resource {
4
4
  resource: string;
5
5
  constructor(payjp: any);
6
- list(query?: I.TenantTransferListOptions): Promise<I.List<I.Statement>>;
6
+ list(query?: I.StatementListOptions): Promise<I.List<I.Statement>>;
7
7
  retrieve(id: string): Promise<I.Statement>;
8
8
  statementUrls(id: string, query?: I.StatementUrlOptions): Promise<I.StatementUrl>;
9
9
  }
@@ -0,0 +1,8 @@
1
+ import Resource from './resource';
2
+ import * as I from './index';
3
+ export default class Terms extends Resource {
4
+ resource: string;
5
+ constructor(payjp: any);
6
+ list(query?: I.TermListOptions): Promise<I.List<I.Term>>;
7
+ retrieve(id: string): Promise<I.Term>;
8
+ }
package/built/term.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const resource_1 = require("./resource");
4
+ class Terms extends resource_1.default {
5
+ resource;
6
+ constructor(payjp) {
7
+ super(payjp);
8
+ this.resource = 'terms';
9
+ }
10
+ list(query = {}) {
11
+ return this.request('GET', this.resource, query);
12
+ }
13
+ retrieve(id) {
14
+ return this.request('GET', `${this.resource}/${id}`);
15
+ }
16
+ }
17
+ exports.default = Terms;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payjp",
3
- "version": "2.1.4",
3
+ "version": "2.2.1",
4
4
  "description": "PAY.JP node.js bindings",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",