@blocklet/payment-types 1.13.113

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/lib/job.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
+ export declare class Job extends Model<InferAttributes<Job>, InferCreationAttributes<Job>> {
3
+ id: CreationOptional<string>;
4
+ queue: string;
5
+ job: any;
6
+ retry_count: number;
7
+ delay?: number;
8
+ will_run_at?: number;
9
+ cancelled?: boolean;
10
+ created_at: CreationOptional<Date>;
11
+ updated_at: CreationOptional<Date>;
12
+ static readonly GENESIS_ATTRIBUTES: {
13
+ id: {
14
+ type: DataTypes.StringDataType;
15
+ primaryKey: boolean;
16
+ allowNull: boolean;
17
+ };
18
+ queue: {
19
+ type: DataTypes.StringDataType;
20
+ allowNull: boolean;
21
+ };
22
+ job: {
23
+ type: DataTypes.AbstractDataTypeConstructor;
24
+ allowNull: boolean;
25
+ };
26
+ retry_count: {
27
+ type: DataTypes.IntegerDataTypeConstructor;
28
+ defaultValue: number;
29
+ };
30
+ delay: {
31
+ type: DataTypes.IntegerDataTypeConstructor;
32
+ defaultValue: number;
33
+ };
34
+ will_run_at: {
35
+ type: DataTypes.IntegerDataTypeConstructor;
36
+ defaultValue: number;
37
+ };
38
+ cancelled: {
39
+ type: DataTypes.AbstractDataTypeConstructor;
40
+ defaultValue: boolean;
41
+ };
42
+ created_at: {
43
+ type: DataTypes.DateDataTypeConstructor;
44
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
45
+ allowNull: boolean;
46
+ };
47
+ updated_at: {
48
+ type: DataTypes.DateDataTypeConstructor;
49
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
50
+ allowNull: boolean;
51
+ };
52
+ };
53
+ static initialize(sequelize: any): void;
54
+ static associate(): void;
55
+ }
56
+ export type TJob = InferAttributes<Job>;
@@ -0,0 +1,99 @@
1
+ import { CreationOptional, DataTypes, FindOptions, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
+ export declare class PaymentCurrency extends Model<InferAttributes<PaymentCurrency>, InferCreationAttributes<PaymentCurrency>> {
3
+ id: CreationOptional<string>;
4
+ payment_method_id: string;
5
+ active: boolean;
6
+ livemode: boolean;
7
+ locked: boolean;
8
+ is_base_currency: boolean;
9
+ name: string;
10
+ description: string;
11
+ logo: string;
12
+ symbol: string;
13
+ decimal: number;
14
+ minimum_payment_amount: string;
15
+ maximum_payment_amount: string;
16
+ contract?: string;
17
+ metadata: Record<string, any>;
18
+ created_at: CreationOptional<Date>;
19
+ updated_at: CreationOptional<Date>;
20
+ static readonly GENESIS_ATTRIBUTES: {
21
+ id: {
22
+ type: DataTypes.StringDataType;
23
+ primaryKey: boolean;
24
+ allowNull: boolean;
25
+ defaultValue: (size?: number | undefined) => string;
26
+ };
27
+ active: {
28
+ type: DataTypes.AbstractDataTypeConstructor;
29
+ allowNull: boolean;
30
+ };
31
+ livemode: {
32
+ type: DataTypes.AbstractDataTypeConstructor;
33
+ allowNull: boolean;
34
+ };
35
+ locked: {
36
+ type: DataTypes.AbstractDataTypeConstructor;
37
+ defaultValue: boolean;
38
+ };
39
+ is_base_currency: {
40
+ type: DataTypes.AbstractDataTypeConstructor;
41
+ defaultValue: boolean;
42
+ };
43
+ payment_method_id: {
44
+ type: DataTypes.StringDataType;
45
+ allowNull: boolean;
46
+ };
47
+ name: {
48
+ type: DataTypes.StringDataType;
49
+ allowNull: boolean;
50
+ };
51
+ description: {
52
+ type: DataTypes.StringDataType;
53
+ allowNull: boolean;
54
+ };
55
+ logo: {
56
+ type: DataTypes.StringDataType;
57
+ allowNull: boolean;
58
+ };
59
+ symbol: {
60
+ type: DataTypes.StringDataType;
61
+ allowNull: boolean;
62
+ unique: boolean;
63
+ };
64
+ decimal: {
65
+ type: DataTypes.NumberDataTypeConstructor;
66
+ defaultValue: number;
67
+ };
68
+ minimum_payment_amount: {
69
+ type: DataTypes.StringDataType;
70
+ defaultValue: string;
71
+ };
72
+ maximum_payment_amount: {
73
+ type: DataTypes.StringDataType;
74
+ defaultValue: string;
75
+ };
76
+ contract: {
77
+ type: DataTypes.StringDataType;
78
+ allowNull: boolean;
79
+ };
80
+ metadata: {
81
+ type: DataTypes.AbstractDataTypeConstructor;
82
+ allowNull: boolean;
83
+ };
84
+ created_at: {
85
+ type: DataTypes.DateDataTypeConstructor;
86
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
87
+ allowNull: boolean;
88
+ };
89
+ updated_at: {
90
+ type: DataTypes.DateDataTypeConstructor;
91
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
92
+ allowNull: boolean;
93
+ };
94
+ };
95
+ static initialize(sequelize: any): void;
96
+ static associate(): void;
97
+ static findByPkOrSymbol(id: string, options?: FindOptions<PaymentCurrency>): Promise<PaymentCurrency | null>;
98
+ }
99
+ export type TPaymentCurrency = InferAttributes<PaymentCurrency>;
@@ -0,0 +1,158 @@
1
+ import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
+ import type { LiteralUnion } from 'type-fest';
3
+ import type { PaymentDetails, PaymentError } from './types';
4
+ export declare const nextPaymentIntentId: (size?: number | undefined) => string;
5
+ export declare class PaymentIntent extends Model<InferAttributes<PaymentIntent>, InferCreationAttributes<PaymentIntent>> {
6
+ id: CreationOptional<string>;
7
+ livemode: boolean;
8
+ description: string;
9
+ amount: string;
10
+ amount_received?: string;
11
+ amount_capturable?: string;
12
+ amount_details?: {
13
+ tip: string;
14
+ };
15
+ currency_id: string;
16
+ customer_id?: string;
17
+ payment_method_id: string;
18
+ invoice_id?: string;
19
+ last_charge?: string;
20
+ last_payment_error: PaymentError | null;
21
+ metadata?: Record<string, any>;
22
+ receipt_email?: string;
23
+ statement_descriptor: string;
24
+ statement_descriptor_suffix?: string;
25
+ status: LiteralUnion<'requires_payment_method' | 'requires_confirmation' | 'requires_action' | 'processing' | 'requires_capture' | 'canceled' | 'succeeded', string>;
26
+ canceled_at?: number;
27
+ cancellation_reason?: LiteralUnion<'abandoned' | 'duplicate' | 'requested_by_customer' | 'fraudulent' | 'failed_invoice' | 'void_invoice' | 'automatic', string>;
28
+ capture_method: LiteralUnion<'automatic' | 'manual', string>;
29
+ confirmation_method: LiteralUnion<'automatic' | 'manual', string>;
30
+ payment_method_types: string[];
31
+ review?: string;
32
+ payment_details?: PaymentDetails;
33
+ setup_future_usage?: LiteralUnion<'off_session' | 'on_session', string>;
34
+ created_at: CreationOptional<Date>;
35
+ updated_at: CreationOptional<Date>;
36
+ static readonly GENESIS_ATTRIBUTES: {
37
+ id: {
38
+ type: DataTypes.StringDataType;
39
+ primaryKey: boolean;
40
+ allowNull: boolean;
41
+ defaultValue: (size?: number | undefined) => string;
42
+ };
43
+ livemode: {
44
+ type: DataTypes.AbstractDataTypeConstructor;
45
+ allowNull: boolean;
46
+ };
47
+ amount: {
48
+ type: DataTypes.StringDataType;
49
+ allowNull: boolean;
50
+ };
51
+ amount_received: {
52
+ type: DataTypes.StringDataType;
53
+ default: string;
54
+ };
55
+ amount_capturable: {
56
+ type: DataTypes.StringDataType;
57
+ default: string;
58
+ };
59
+ amount_details: {
60
+ type: DataTypes.AbstractDataTypeConstructor;
61
+ allowNull: boolean;
62
+ };
63
+ currency_id: {
64
+ type: DataTypes.StringDataType;
65
+ allowNull: boolean;
66
+ };
67
+ customer_id: {
68
+ type: DataTypes.StringDataType;
69
+ allowNull: boolean;
70
+ };
71
+ description: {
72
+ type: DataTypes.StringDataType;
73
+ allowNull: boolean;
74
+ };
75
+ last_payment_error: {
76
+ type: DataTypes.AbstractDataTypeConstructor;
77
+ allowNull: boolean;
78
+ };
79
+ last_charge: {
80
+ type: DataTypes.StringDataType;
81
+ allowNull: boolean;
82
+ };
83
+ metadata: {
84
+ type: DataTypes.AbstractDataTypeConstructor;
85
+ allowNull: boolean;
86
+ };
87
+ invoice_id: {
88
+ type: DataTypes.StringDataType;
89
+ allowNull: boolean;
90
+ };
91
+ payment_method_id: {
92
+ type: DataTypes.StringDataType;
93
+ allowNull: boolean;
94
+ };
95
+ receipt_email: {
96
+ type: DataTypes.StringDataType;
97
+ allowNull: boolean;
98
+ };
99
+ statement_descriptor: {
100
+ type: DataTypes.StringDataType;
101
+ allowNull: boolean;
102
+ };
103
+ statement_descriptor_suffix: {
104
+ type: DataTypes.StringDataType;
105
+ allowNull: boolean;
106
+ };
107
+ status: {
108
+ type: DataTypes.EnumDataType<"requires_payment_method" | "requires_confirmation" | "requires_action" | "processing" | "requires_capture" | "canceled" | "succeeded">;
109
+ allowNull: boolean;
110
+ };
111
+ canceled_at: {
112
+ type: DataTypes.DateDataTypeConstructor;
113
+ allowNull: boolean;
114
+ };
115
+ cancellation_reason: {
116
+ type: DataTypes.EnumDataType<"automatic" | "abandoned" | "duplicate" | "requested_by_customer" | "fraudulent" | "failed_invoice" | "void_invoice">;
117
+ allowNull: boolean;
118
+ };
119
+ capture_method: {
120
+ type: DataTypes.EnumDataType<"automatic" | "manual">;
121
+ allowNull: boolean;
122
+ };
123
+ confirmation_method: {
124
+ type: DataTypes.EnumDataType<"automatic" | "manual">;
125
+ allowNull: boolean;
126
+ };
127
+ payment_method_types: {
128
+ type: DataTypes.AbstractDataTypeConstructor;
129
+ defaultValue: never[];
130
+ };
131
+ review: {
132
+ type: DataTypes.StringDataType;
133
+ allowNull: boolean;
134
+ };
135
+ payment_details: {
136
+ type: DataTypes.AbstractDataTypeConstructor;
137
+ allowNull: boolean;
138
+ };
139
+ setup_future_usage: {
140
+ type: DataTypes.EnumDataType<"off_session" | "on_session">;
141
+ allowNull: boolean;
142
+ };
143
+ created_at: {
144
+ type: DataTypes.DateDataTypeConstructor;
145
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
146
+ allowNull: boolean;
147
+ };
148
+ updated_at: {
149
+ type: DataTypes.DateDataTypeConstructor;
150
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
151
+ allowNull: boolean;
152
+ };
153
+ };
154
+ static initialize(sequelize: any): void;
155
+ static associate(models: any): void;
156
+ isImmutable(): boolean;
157
+ }
158
+ export type TPaymentIntent = InferAttributes<PaymentIntent>;
@@ -0,0 +1,143 @@
1
+ import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
2
+ import type { LiteralUnion } from 'type-fest';
3
+ import type { AfterPayment, CustomField, LineItem, NftMintSettings } from './types';
4
+ export declare const nextPaymentLinkId: (size?: number | undefined) => string;
5
+ export declare class PaymentLink extends Model<InferAttributes<PaymentLink>, InferCreationAttributes<PaymentLink>> {
6
+ id: CreationOptional<string>;
7
+ active: boolean;
8
+ livemode: boolean;
9
+ name: string;
10
+ line_items: LineItem[];
11
+ currency_id: string;
12
+ after_completion?: AfterPayment;
13
+ allow_promotion_codes: boolean;
14
+ consent_collection?: {
15
+ promotions?: LiteralUnion<'auto' | 'none', string>;
16
+ terms_of_service?: LiteralUnion<'required' | 'none', string>;
17
+ };
18
+ custom_fields: CustomField[];
19
+ custom_text?: {
20
+ shipping_address?: string;
21
+ submit?: string;
22
+ };
23
+ customer_creation: LiteralUnion<'if_required' | 'always', string>;
24
+ invoice_creation?: {
25
+ enabled: boolean;
26
+ invoice_data?: any;
27
+ };
28
+ payment_method_types?: string[];
29
+ phone_number_collection?: {
30
+ enabled: boolean;
31
+ };
32
+ billing_address_collection?: LiteralUnion<'auto' | 'required', string>;
33
+ submit_type: LiteralUnion<'auto' | 'book' | 'donate' | 'pay', string>;
34
+ subscription_data?: {
35
+ description: string;
36
+ trial_period_days: number;
37
+ };
38
+ nft_mint_settings?: NftMintSettings;
39
+ cross_sell_behavior?: LiteralUnion<'auto' | 'required', string>;
40
+ metadata?: Record<string, any>;
41
+ created_at: CreationOptional<Date>;
42
+ created_via: LiteralUnion<'api' | 'dashboard' | 'portal', string>;
43
+ updated_at: CreationOptional<Date>;
44
+ static readonly GENESIS_ATTRIBUTES: {
45
+ id: {
46
+ type: DataTypes.StringDataType;
47
+ primaryKey: boolean;
48
+ allowNull: boolean;
49
+ defaultValue: (size?: number | undefined) => string;
50
+ };
51
+ active: {
52
+ type: DataTypes.AbstractDataTypeConstructor;
53
+ allowNull: boolean;
54
+ };
55
+ livemode: {
56
+ type: DataTypes.AbstractDataTypeConstructor;
57
+ allowNull: boolean;
58
+ };
59
+ line_items: {
60
+ type: DataTypes.AbstractDataTypeConstructor;
61
+ defaultValue: never[];
62
+ };
63
+ name: {
64
+ type: DataTypes.StringDataType;
65
+ allowNull: boolean;
66
+ };
67
+ currency_id: {
68
+ type: DataTypes.StringDataType;
69
+ allowNull: boolean;
70
+ };
71
+ after_completion: {
72
+ type: DataTypes.AbstractDataTypeConstructor;
73
+ defaultValue: {
74
+ type: string;
75
+ };
76
+ };
77
+ allow_promotion_codes: {
78
+ type: DataTypes.AbstractDataTypeConstructor;
79
+ defaultValue: boolean;
80
+ };
81
+ consent_collection: {
82
+ type: DataTypes.AbstractDataTypeConstructor;
83
+ allowNull: boolean;
84
+ };
85
+ custom_fields: {
86
+ type: DataTypes.AbstractDataTypeConstructor;
87
+ defaultValue: never[];
88
+ };
89
+ custom_text: {
90
+ type: DataTypes.AbstractDataTypeConstructor;
91
+ allowNull: boolean;
92
+ };
93
+ customer_creation: {
94
+ type: DataTypes.EnumDataType<"if_required" | "always">;
95
+ allowNull: boolean;
96
+ };
97
+ invoice_creation: {
98
+ type: DataTypes.AbstractDataTypeConstructor;
99
+ allowNull: boolean;
100
+ };
101
+ payment_method_types: {
102
+ type: DataTypes.AbstractDataTypeConstructor;
103
+ defaultValue: never[];
104
+ };
105
+ phone_number_collection: {
106
+ type: DataTypes.AbstractDataTypeConstructor;
107
+ allowNull: boolean;
108
+ };
109
+ billing_address_collection: {
110
+ type: DataTypes.EnumDataType<"auto" | "required">;
111
+ defaultValue: string;
112
+ allowNull: boolean;
113
+ };
114
+ submit_type: {
115
+ type: DataTypes.EnumDataType<"auto" | "book" | "donate" | "pay">;
116
+ allowNull: boolean;
117
+ };
118
+ subscription_data: {
119
+ type: DataTypes.AbstractDataTypeConstructor;
120
+ allowNull: boolean;
121
+ };
122
+ metadata: {
123
+ type: DataTypes.AbstractDataTypeConstructor;
124
+ allowNull: boolean;
125
+ };
126
+ created_at: {
127
+ type: DataTypes.DateDataTypeConstructor;
128
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
129
+ allowNull: boolean;
130
+ };
131
+ created_via: {
132
+ type: DataTypes.EnumDataType<"api" | "dashboard" | "portal">;
133
+ };
134
+ updated_at: {
135
+ type: DataTypes.DateDataTypeConstructor;
136
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
137
+ allowNull: boolean;
138
+ };
139
+ };
140
+ static initialize(sequelize: any): void;
141
+ static associate(models: any): void;
142
+ }
143
+ export type TPaymentLink = InferAttributes<PaymentLink>;
@@ -0,0 +1,102 @@
1
+ import OcapClient from '@ocap/client';
2
+ import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
3
+ import Stripe from 'stripe';
4
+ import type { LiteralUnion } from 'type-fest';
5
+ import type { PaymentMethodSettings } from './types';
6
+ export declare class PaymentMethod extends Model<InferAttributes<PaymentMethod>, InferCreationAttributes<PaymentMethod>> {
7
+ id: CreationOptional<string>;
8
+ active: boolean;
9
+ livemode: boolean;
10
+ locked: boolean;
11
+ type: LiteralUnion<'stripe' | 'arcblock' | 'ethereum' | 'bitcoin', string>;
12
+ name: string;
13
+ description: string;
14
+ logo: string;
15
+ default_currency_id?: string;
16
+ confirmation: {
17
+ type: LiteralUnion<'immediate' | 'callback' | 'block', string>;
18
+ block?: number;
19
+ };
20
+ settings: PaymentMethodSettings;
21
+ features: {
22
+ recurring: boolean;
23
+ refund: boolean;
24
+ dispute: boolean;
25
+ };
26
+ metadata: Record<string, any>;
27
+ created_at: CreationOptional<Date>;
28
+ updated_at: CreationOptional<Date>;
29
+ static readonly GENESIS_ATTRIBUTES: {
30
+ id: {
31
+ type: DataTypes.StringDataType;
32
+ primaryKey: boolean;
33
+ allowNull: boolean;
34
+ defaultValue: (size?: number | undefined) => string;
35
+ };
36
+ active: {
37
+ type: DataTypes.AbstractDataTypeConstructor;
38
+ allowNull: boolean;
39
+ };
40
+ livemode: {
41
+ type: DataTypes.AbstractDataTypeConstructor;
42
+ allowNull: boolean;
43
+ };
44
+ locked: {
45
+ type: DataTypes.AbstractDataTypeConstructor;
46
+ defaultValue: boolean;
47
+ };
48
+ type: {
49
+ type: DataTypes.EnumDataType<"arcblock" | "ethereum" | "bitcoin" | "stripe">;
50
+ };
51
+ name: {
52
+ type: DataTypes.StringDataType;
53
+ };
54
+ description: {
55
+ type: DataTypes.StringDataType;
56
+ };
57
+ logo: {
58
+ type: DataTypes.StringDataType;
59
+ };
60
+ default_currency_id: {
61
+ type: DataTypes.StringDataType;
62
+ allowNull: boolean;
63
+ };
64
+ confirmation: {
65
+ type: DataTypes.AbstractDataTypeConstructor;
66
+ allowNull: boolean;
67
+ };
68
+ settings: {
69
+ type: DataTypes.AbstractDataTypeConstructor;
70
+ allowNull: boolean;
71
+ };
72
+ features: {
73
+ type: DataTypes.AbstractDataTypeConstructor;
74
+ allowNull: boolean;
75
+ };
76
+ metadata: {
77
+ type: DataTypes.AbstractDataTypeConstructor;
78
+ allowNull: boolean;
79
+ };
80
+ created_at: {
81
+ type: DataTypes.DateDataTypeConstructor;
82
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
83
+ allowNull: boolean;
84
+ };
85
+ updated_at: {
86
+ type: DataTypes.DateDataTypeConstructor;
87
+ defaultValue: DataTypes.AbstractDataTypeConstructor;
88
+ allowNull: boolean;
89
+ };
90
+ };
91
+ static initialize(sequelize: any): void;
92
+ static associate(models: any): void;
93
+ static expand(livemode?: boolean, conditions?: Record<string, any>): Promise<InferAttributes<PaymentMethod, {
94
+ omit: never;
95
+ }>[]>;
96
+ static encryptSettings(settings: PaymentMethodSettings): PaymentMethodSettings;
97
+ static decryptSettings(settings: PaymentMethodSettings): PaymentMethodSettings;
98
+ getStripeClient(): Stripe;
99
+ getOcapClient(): OcapClient;
100
+ static supportAutoCharge(id: string): Promise<boolean | null>;
101
+ }
102
+ export type TPaymentMethod = InferAttributes<PaymentMethod>;