@paykit-sdk/paypal 1.0.2 → 1.0.4

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,138 @@
1
+ import { Schema } from '@paypal/paypal-server-sdk/dist/types/schema';
2
+
3
+ interface ShippingAmount {
4
+ /**
5
+ * The currency code.
6
+ */
7
+ currency_code: string;
8
+ /**
9
+ * The value which might be an integer for currencies like JPY that are not typically fractional.
10
+ */
11
+ value: string;
12
+ }
13
+ declare const shippingAmountSchema: Schema<ShippingAmount>;
14
+ interface CreateSubscriptionSchema {
15
+ /**
16
+ * The ID of the plan, maps to `item_id` in the Paykit SDK.
17
+ */
18
+ plan_id: string;
19
+ /**
20
+ * The quantity of the plan.
21
+ */
22
+ quantity: number;
23
+ /**
24
+ * The custom ID of the subscription.
25
+ */
26
+ custom_id: string;
27
+ /**
28
+ * The start time of the subscription.
29
+ */
30
+ start_time: string;
31
+ /**
32
+ * The subscriber of the subscription.
33
+ */
34
+ subscriber: {
35
+ email_address: string;
36
+ name: {
37
+ given_name: string;
38
+ surname: string;
39
+ };
40
+ phone: {
41
+ phone_number: string;
42
+ };
43
+ };
44
+ }
45
+ declare const createSubscriptionApticSchema: Schema<CreateSubscriptionSchema>;
46
+ declare enum SubscriptionStatus {
47
+ APPROVAL_PENDING = "APPROVAL_PENDING",
48
+ APPROVED = "APPROVED",
49
+ ACTIVE = "ACTIVE",
50
+ SUSPENDED = "SUSPENDED",
51
+ CANCELLED = "CANCELLED",
52
+ EXPIRED = "EXPIRED"
53
+ }
54
+ interface Subscription {
55
+ /**
56
+ * The ID of the subscription.
57
+ */
58
+ id: string;
59
+ /**
60
+ * The ID of the plan.
61
+ */
62
+ plan_id: string;
63
+ /**
64
+ * The quantity of the subscription.
65
+ */
66
+ quantity: number;
67
+ /**
68
+ * The status of the subscription.
69
+ */
70
+ status: SubscriptionStatus;
71
+ /**
72
+ * The time the status was updated.
73
+ */
74
+ status_update_time: string;
75
+ /**
76
+ * The note for the status change.
77
+ */
78
+ status_change_note: string;
79
+ /**
80
+ * The time the subscription started.
81
+ */
82
+ start_time: string;
83
+ /**
84
+ * The subscriber of the subscription.
85
+ */
86
+ subscriber: {
87
+ /**
88
+ * The email address of the subscriber.
89
+ */
90
+ email_address: string;
91
+ /**
92
+ * The name of the subscriber.
93
+ */
94
+ name: {
95
+ /**
96
+ * The given name of the subscriber.
97
+ */
98
+ given_name: string;
99
+ /**
100
+ * The surname of the subscriber.
101
+ */
102
+ surname: string;
103
+ };
104
+ /**
105
+ * The ID of the payer.
106
+ */
107
+ payer_id: string;
108
+ };
109
+ /**
110
+ * Whether the plan was overridden.
111
+ */
112
+ plan_overridden: boolean;
113
+ /**
114
+ * The custom ID of the subscription.
115
+ */
116
+ custom_id: string;
117
+ }
118
+ declare const subscriptionApticSchema: Schema<Subscription>;
119
+ interface ResumeSubscriptionSchema {
120
+ /**
121
+ * The reason for resuming the subscription.
122
+ */
123
+ reason: string;
124
+ }
125
+ declare const resumeSubscriptionApticSchemaRequest: Schema<ResumeSubscriptionSchema>;
126
+ declare enum VerifyWebhookStatus {
127
+ SUCCESS = "SUCCESS",
128
+ FAILURE = "FAILURE"
129
+ }
130
+ interface VerifyWebhookSchema {
131
+ /**
132
+ * The status of the verification.
133
+ */
134
+ verification_status: VerifyWebhookStatus;
135
+ }
136
+ declare const verifyWebhookSchema: Schema<VerifyWebhookSchema>;
137
+
138
+ export { type CreateSubscriptionSchema, type ShippingAmount, type Subscription, type VerifyWebhookSchema, VerifyWebhookStatus, createSubscriptionApticSchema, resumeSubscriptionApticSchemaRequest, shippingAmountSchema, subscriptionApticSchema, verifyWebhookSchema };
@@ -0,0 +1,138 @@
1
+ import { Schema } from '@paypal/paypal-server-sdk/dist/types/schema';
2
+
3
+ interface ShippingAmount {
4
+ /**
5
+ * The currency code.
6
+ */
7
+ currency_code: string;
8
+ /**
9
+ * The value which might be an integer for currencies like JPY that are not typically fractional.
10
+ */
11
+ value: string;
12
+ }
13
+ declare const shippingAmountSchema: Schema<ShippingAmount>;
14
+ interface CreateSubscriptionSchema {
15
+ /**
16
+ * The ID of the plan, maps to `item_id` in the Paykit SDK.
17
+ */
18
+ plan_id: string;
19
+ /**
20
+ * The quantity of the plan.
21
+ */
22
+ quantity: number;
23
+ /**
24
+ * The custom ID of the subscription.
25
+ */
26
+ custom_id: string;
27
+ /**
28
+ * The start time of the subscription.
29
+ */
30
+ start_time: string;
31
+ /**
32
+ * The subscriber of the subscription.
33
+ */
34
+ subscriber: {
35
+ email_address: string;
36
+ name: {
37
+ given_name: string;
38
+ surname: string;
39
+ };
40
+ phone: {
41
+ phone_number: string;
42
+ };
43
+ };
44
+ }
45
+ declare const createSubscriptionApticSchema: Schema<CreateSubscriptionSchema>;
46
+ declare enum SubscriptionStatus {
47
+ APPROVAL_PENDING = "APPROVAL_PENDING",
48
+ APPROVED = "APPROVED",
49
+ ACTIVE = "ACTIVE",
50
+ SUSPENDED = "SUSPENDED",
51
+ CANCELLED = "CANCELLED",
52
+ EXPIRED = "EXPIRED"
53
+ }
54
+ interface Subscription {
55
+ /**
56
+ * The ID of the subscription.
57
+ */
58
+ id: string;
59
+ /**
60
+ * The ID of the plan.
61
+ */
62
+ plan_id: string;
63
+ /**
64
+ * The quantity of the subscription.
65
+ */
66
+ quantity: number;
67
+ /**
68
+ * The status of the subscription.
69
+ */
70
+ status: SubscriptionStatus;
71
+ /**
72
+ * The time the status was updated.
73
+ */
74
+ status_update_time: string;
75
+ /**
76
+ * The note for the status change.
77
+ */
78
+ status_change_note: string;
79
+ /**
80
+ * The time the subscription started.
81
+ */
82
+ start_time: string;
83
+ /**
84
+ * The subscriber of the subscription.
85
+ */
86
+ subscriber: {
87
+ /**
88
+ * The email address of the subscriber.
89
+ */
90
+ email_address: string;
91
+ /**
92
+ * The name of the subscriber.
93
+ */
94
+ name: {
95
+ /**
96
+ * The given name of the subscriber.
97
+ */
98
+ given_name: string;
99
+ /**
100
+ * The surname of the subscriber.
101
+ */
102
+ surname: string;
103
+ };
104
+ /**
105
+ * The ID of the payer.
106
+ */
107
+ payer_id: string;
108
+ };
109
+ /**
110
+ * Whether the plan was overridden.
111
+ */
112
+ plan_overridden: boolean;
113
+ /**
114
+ * The custom ID of the subscription.
115
+ */
116
+ custom_id: string;
117
+ }
118
+ declare const subscriptionApticSchema: Schema<Subscription>;
119
+ interface ResumeSubscriptionSchema {
120
+ /**
121
+ * The reason for resuming the subscription.
122
+ */
123
+ reason: string;
124
+ }
125
+ declare const resumeSubscriptionApticSchemaRequest: Schema<ResumeSubscriptionSchema>;
126
+ declare enum VerifyWebhookStatus {
127
+ SUCCESS = "SUCCESS",
128
+ FAILURE = "FAILURE"
129
+ }
130
+ interface VerifyWebhookSchema {
131
+ /**
132
+ * The status of the verification.
133
+ */
134
+ verification_status: VerifyWebhookStatus;
135
+ }
136
+ declare const verifyWebhookSchema: Schema<VerifyWebhookSchema>;
137
+
138
+ export { type CreateSubscriptionSchema, type ShippingAmount, type Subscription, type VerifyWebhookSchema, VerifyWebhookStatus, createSubscriptionApticSchema, resumeSubscriptionApticSchemaRequest, shippingAmountSchema, subscriptionApticSchema, verifyWebhookSchema };
package/dist/schema.js ADDED
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ var schema = require('@paypal/paypal-server-sdk/dist/types/schema');
4
+
5
+ // src/schema.ts
6
+ var shippingAmountSchema = schema.object({
7
+ currency_code: ["currency_code", schema.string()],
8
+ value: ["value", schema.string()]
9
+ });
10
+ var createSubscriptionApticSchema = schema.object({
11
+ plan_id: ["plan_id", schema.string()],
12
+ quantity: ["quantity", schema.number()],
13
+ custom_id: ["custom_id", schema.string()],
14
+ start_time: ["start_time", schema.string()],
15
+ subscriber: [
16
+ "subscriber",
17
+ schema.lazy(
18
+ () => schema.object({
19
+ email_address: ["email_address", schema.string()],
20
+ name: [
21
+ "name",
22
+ schema.lazy(
23
+ () => schema.object({
24
+ given_name: ["given_name", schema.string()],
25
+ surname: ["surname", schema.string()]
26
+ })
27
+ )
28
+ ],
29
+ phone: [
30
+ "phone",
31
+ schema.lazy(() => schema.object({ phone_number: ["phone_number", schema.string()] }))
32
+ ]
33
+ })
34
+ )
35
+ ]
36
+ });
37
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
38
+ SubscriptionStatus2["APPROVAL_PENDING"] = "APPROVAL_PENDING";
39
+ SubscriptionStatus2["APPROVED"] = "APPROVED";
40
+ SubscriptionStatus2["ACTIVE"] = "ACTIVE";
41
+ SubscriptionStatus2["SUSPENDED"] = "SUSPENDED";
42
+ SubscriptionStatus2["CANCELLED"] = "CANCELLED";
43
+ SubscriptionStatus2["EXPIRED"] = "EXPIRED";
44
+ return SubscriptionStatus2;
45
+ })(SubscriptionStatus || {});
46
+ var subscriptionApticSchema = schema.object({
47
+ id: ["id", schema.string()],
48
+ plan_id: ["plan_id", schema.string()],
49
+ quantity: ["quantity", schema.number()],
50
+ custom_id: ["custom_id", schema.string()],
51
+ plan_overridden: ["plan_overridden", schema.boolean()],
52
+ start_time: ["start_time", schema.string()],
53
+ subscriber: [
54
+ "subscriber",
55
+ schema.lazy(
56
+ () => schema.object({
57
+ email_address: ["email_address", schema.string()],
58
+ name: [
59
+ "name",
60
+ schema.lazy(
61
+ () => schema.object({
62
+ given_name: ["given_name", schema.string()],
63
+ surname: ["surname", schema.string()]
64
+ })
65
+ )
66
+ ],
67
+ payer_id: ["payer_id", schema.string()]
68
+ })
69
+ )
70
+ ],
71
+ status: ["status", schema.stringEnum(SubscriptionStatus)],
72
+ status_change_note: ["status_change_note", schema.string()],
73
+ status_update_time: ["status_update_time", schema.string()]
74
+ });
75
+ var resumeSubscriptionApticSchemaRequest = schema.object({
76
+ reason: ["reason", schema.string()]
77
+ });
78
+ var VerifyWebhookStatus = /* @__PURE__ */ ((VerifyWebhookStatus2) => {
79
+ VerifyWebhookStatus2["SUCCESS"] = "SUCCESS";
80
+ VerifyWebhookStatus2["FAILURE"] = "FAILURE";
81
+ return VerifyWebhookStatus2;
82
+ })(VerifyWebhookStatus || {});
83
+ var verifyWebhookSchema = schema.object({
84
+ verification_status: ["verification_status", schema.stringEnum(VerifyWebhookStatus)]
85
+ });
86
+
87
+ exports.VerifyWebhookStatus = VerifyWebhookStatus;
88
+ exports.createSubscriptionApticSchema = createSubscriptionApticSchema;
89
+ exports.resumeSubscriptionApticSchemaRequest = resumeSubscriptionApticSchemaRequest;
90
+ exports.shippingAmountSchema = shippingAmountSchema;
91
+ exports.subscriptionApticSchema = subscriptionApticSchema;
92
+ exports.verifyWebhookSchema = verifyWebhookSchema;
@@ -0,0 +1,85 @@
1
+ import { object, string, lazy, number, stringEnum, boolean } from '@paypal/paypal-server-sdk/dist/types/schema';
2
+
3
+ // src/schema.ts
4
+ var shippingAmountSchema = object({
5
+ currency_code: ["currency_code", string()],
6
+ value: ["value", string()]
7
+ });
8
+ var createSubscriptionApticSchema = object({
9
+ plan_id: ["plan_id", string()],
10
+ quantity: ["quantity", number()],
11
+ custom_id: ["custom_id", string()],
12
+ start_time: ["start_time", string()],
13
+ subscriber: [
14
+ "subscriber",
15
+ lazy(
16
+ () => object({
17
+ email_address: ["email_address", string()],
18
+ name: [
19
+ "name",
20
+ lazy(
21
+ () => object({
22
+ given_name: ["given_name", string()],
23
+ surname: ["surname", string()]
24
+ })
25
+ )
26
+ ],
27
+ phone: [
28
+ "phone",
29
+ lazy(() => object({ phone_number: ["phone_number", string()] }))
30
+ ]
31
+ })
32
+ )
33
+ ]
34
+ });
35
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
36
+ SubscriptionStatus2["APPROVAL_PENDING"] = "APPROVAL_PENDING";
37
+ SubscriptionStatus2["APPROVED"] = "APPROVED";
38
+ SubscriptionStatus2["ACTIVE"] = "ACTIVE";
39
+ SubscriptionStatus2["SUSPENDED"] = "SUSPENDED";
40
+ SubscriptionStatus2["CANCELLED"] = "CANCELLED";
41
+ SubscriptionStatus2["EXPIRED"] = "EXPIRED";
42
+ return SubscriptionStatus2;
43
+ })(SubscriptionStatus || {});
44
+ var subscriptionApticSchema = object({
45
+ id: ["id", string()],
46
+ plan_id: ["plan_id", string()],
47
+ quantity: ["quantity", number()],
48
+ custom_id: ["custom_id", string()],
49
+ plan_overridden: ["plan_overridden", boolean()],
50
+ start_time: ["start_time", string()],
51
+ subscriber: [
52
+ "subscriber",
53
+ lazy(
54
+ () => object({
55
+ email_address: ["email_address", string()],
56
+ name: [
57
+ "name",
58
+ lazy(
59
+ () => object({
60
+ given_name: ["given_name", string()],
61
+ surname: ["surname", string()]
62
+ })
63
+ )
64
+ ],
65
+ payer_id: ["payer_id", string()]
66
+ })
67
+ )
68
+ ],
69
+ status: ["status", stringEnum(SubscriptionStatus)],
70
+ status_change_note: ["status_change_note", string()],
71
+ status_update_time: ["status_update_time", string()]
72
+ });
73
+ var resumeSubscriptionApticSchemaRequest = object({
74
+ reason: ["reason", string()]
75
+ });
76
+ var VerifyWebhookStatus = /* @__PURE__ */ ((VerifyWebhookStatus2) => {
77
+ VerifyWebhookStatus2["SUCCESS"] = "SUCCESS";
78
+ VerifyWebhookStatus2["FAILURE"] = "FAILURE";
79
+ return VerifyWebhookStatus2;
80
+ })(VerifyWebhookStatus || {});
81
+ var verifyWebhookSchema = object({
82
+ verification_status: ["verification_status", stringEnum(VerifyWebhookStatus)]
83
+ });
84
+
85
+ export { VerifyWebhookStatus, createSubscriptionApticSchema, resumeSubscriptionApticSchemaRequest, shippingAmountSchema, subscriptionApticSchema, verifyWebhookSchema };
@@ -0,0 +1,108 @@
1
+ type SubscriptionStatus = 'APPROVAL_PENDING' | 'APPROVED' | 'ACTIVE' | 'SUSPENDED' | 'CANCELLED' | 'EXPIRED';
2
+ interface PayPalSubscription {
3
+ /**
4
+ * The ID of the subscription.
5
+ */
6
+ id: string;
7
+ /**
8
+ * The ID of the plan.
9
+ */
10
+ plan_id: string;
11
+ /**
12
+ * The status of the subscription.
13
+ */
14
+ status: SubscriptionStatus;
15
+ /**
16
+ * The time the status was updated.
17
+ */
18
+ status_update_time?: string;
19
+ /**
20
+ * The time the subscription started.
21
+ */
22
+ start_time?: string;
23
+ /**
24
+ * The time the subscription was created.
25
+ */
26
+ create_time?: string;
27
+ /**
28
+ * The subscriber of the subscription.
29
+ */
30
+ subscriber?: {
31
+ /**
32
+ * The email of the subscriber.
33
+ */
34
+ email_address?: string;
35
+ /**
36
+ * The name of the subscriber.
37
+ */
38
+ name?: {
39
+ /**
40
+ * The given name of the subscriber.
41
+ */
42
+ given_name?: string;
43
+ /**
44
+ * The surname of the subscriber.
45
+ */
46
+ surname?: string;
47
+ };
48
+ };
49
+ /**
50
+ * The billing info of the subscription.
51
+ */
52
+ billing_info?: {
53
+ /**
54
+ * The outstanding balance of the subscription.
55
+ */
56
+ outstanding_balance?: {
57
+ /**
58
+ * The currency code of the outstanding balance.
59
+ */
60
+ currency_code?: string;
61
+ /**
62
+ * The value of the outstanding balance.
63
+ */
64
+ value?: string;
65
+ };
66
+ cycle_executions?: Array<{
67
+ /**
68
+ * The tenure type of the cycle execution.
69
+ */
70
+ tenure_type?: string;
71
+ /**
72
+ * The sequence of the cycle execution.
73
+ */
74
+ sequence?: number;
75
+ /**
76
+ * The number of cycles completed.
77
+ */
78
+ cycles_completed?: number;
79
+ /**
80
+ * The total number of cycles.
81
+ */
82
+ total_cycles?: number;
83
+ }>;
84
+ };
85
+ /**
86
+ * The links of the subscription.
87
+ */
88
+ links?: Array<{
89
+ /**
90
+ * The href of the link.
91
+ */
92
+ href?: string;
93
+ /**
94
+ * The rel of the link.
95
+ */
96
+ rel?: string;
97
+ /**
98
+ * The method of the link.
99
+ */
100
+ method?: string;
101
+ }>;
102
+ /**
103
+ * The custom ID of the subscription, i.e metadata
104
+ */
105
+ customId?: string;
106
+ }
107
+
108
+ export type { PayPalSubscription, SubscriptionStatus };
@@ -0,0 +1,108 @@
1
+ type SubscriptionStatus = 'APPROVAL_PENDING' | 'APPROVED' | 'ACTIVE' | 'SUSPENDED' | 'CANCELLED' | 'EXPIRED';
2
+ interface PayPalSubscription {
3
+ /**
4
+ * The ID of the subscription.
5
+ */
6
+ id: string;
7
+ /**
8
+ * The ID of the plan.
9
+ */
10
+ plan_id: string;
11
+ /**
12
+ * The status of the subscription.
13
+ */
14
+ status: SubscriptionStatus;
15
+ /**
16
+ * The time the status was updated.
17
+ */
18
+ status_update_time?: string;
19
+ /**
20
+ * The time the subscription started.
21
+ */
22
+ start_time?: string;
23
+ /**
24
+ * The time the subscription was created.
25
+ */
26
+ create_time?: string;
27
+ /**
28
+ * The subscriber of the subscription.
29
+ */
30
+ subscriber?: {
31
+ /**
32
+ * The email of the subscriber.
33
+ */
34
+ email_address?: string;
35
+ /**
36
+ * The name of the subscriber.
37
+ */
38
+ name?: {
39
+ /**
40
+ * The given name of the subscriber.
41
+ */
42
+ given_name?: string;
43
+ /**
44
+ * The surname of the subscriber.
45
+ */
46
+ surname?: string;
47
+ };
48
+ };
49
+ /**
50
+ * The billing info of the subscription.
51
+ */
52
+ billing_info?: {
53
+ /**
54
+ * The outstanding balance of the subscription.
55
+ */
56
+ outstanding_balance?: {
57
+ /**
58
+ * The currency code of the outstanding balance.
59
+ */
60
+ currency_code?: string;
61
+ /**
62
+ * The value of the outstanding balance.
63
+ */
64
+ value?: string;
65
+ };
66
+ cycle_executions?: Array<{
67
+ /**
68
+ * The tenure type of the cycle execution.
69
+ */
70
+ tenure_type?: string;
71
+ /**
72
+ * The sequence of the cycle execution.
73
+ */
74
+ sequence?: number;
75
+ /**
76
+ * The number of cycles completed.
77
+ */
78
+ cycles_completed?: number;
79
+ /**
80
+ * The total number of cycles.
81
+ */
82
+ total_cycles?: number;
83
+ }>;
84
+ };
85
+ /**
86
+ * The links of the subscription.
87
+ */
88
+ links?: Array<{
89
+ /**
90
+ * The href of the link.
91
+ */
92
+ href?: string;
93
+ /**
94
+ * The rel of the link.
95
+ */
96
+ rel?: string;
97
+ /**
98
+ * The method of the link.
99
+ */
100
+ method?: string;
101
+ }>;
102
+ /**
103
+ * The custom ID of the subscription, i.e metadata
104
+ */
105
+ customId?: string;
106
+ }
107
+
108
+ export type { PayPalSubscription, SubscriptionStatus };
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/dist/types.mjs ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,22 @@
1
+ import { Refund as Refund$1, Checkout, Payment, Subscription } from '@paykit-sdk/core';
2
+ import { Refund, Order } from '@paypal/paypal-server-sdk';
3
+ import { PayPalSubscription } from '../types.mjs';
4
+
5
+ /**
6
+ * Refund
7
+ */
8
+ declare const paykitRefund$InboundSchema: (refund: Refund) => Refund$1;
9
+ /**
10
+ * Checkout
11
+ */
12
+ declare const paykitCheckout$InboundSchema: (order: Order) => Checkout;
13
+ /**
14
+ * Payment
15
+ */
16
+ declare const paykitPayment$InboundSchema: (order: Order) => Payment;
17
+ /**
18
+ * Subscription
19
+ */
20
+ declare const paykitSubscription$InboundSchema: (subscription: PayPalSubscription) => Subscription;
21
+
22
+ export { paykitCheckout$InboundSchema, paykitPayment$InboundSchema, paykitRefund$InboundSchema, paykitSubscription$InboundSchema };