@dodopayments/convex 0.2.2 → 0.2.6
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 +85 -87
- package/dist/client/index.d.ts +14 -7
- package/dist/component/lib.d.ts +19 -3
- package/dist/component/lib.js +20 -4
- package/dist/component/lib.js.map +1 -1
- package/dist/index.cjs +384 -501
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -8
- package/dist/index.js +384 -501
- package/dist/index.js.map +1 -1
- package/dist/node_modules/zod/v3/types.js +2 -2
- package/dist/node_modules/zod/v3/types.js.map +1 -1
- package/dist/packages/core/dist/chunk-7ICTY2GO.js +463 -0
- package/dist/packages/core/dist/chunk-7ICTY2GO.js.map +1 -0
- package/package.json +3 -3
- package/dist/packages/core/dist/checkout/checkout.js +0 -532
- package/dist/packages/core/dist/checkout/checkout.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ class DodoPayments {
|
|
|
24
24
|
},
|
|
25
25
|
/**
|
|
26
26
|
* Retrieves a URL for the customer portal.
|
|
27
|
-
*
|
|
27
|
+
* Requires the user to be identified via the identify function in the config.
|
|
28
28
|
*/
|
|
29
29
|
customerPortal: async (ctx, args) => {
|
|
30
30
|
const identity = await this.config.identify(ctx);
|
|
@@ -4959,351 +4959,346 @@ ZodPromise.create;
|
|
|
4959
4959
|
ZodOptional.create;
|
|
4960
4960
|
ZodNullable.create;
|
|
4961
4961
|
|
|
4962
|
+
// src/schemas/webhook.ts
|
|
4962
4963
|
var PaymentSchema = objectType({
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
"dispute_opened",
|
|
4995
|
-
"dispute_won",
|
|
4996
|
-
"dispute_lost",
|
|
4997
|
-
]),
|
|
4998
|
-
dispute_status: enumType([
|
|
4999
|
-
"dispute_opened",
|
|
5000
|
-
"dispute_won",
|
|
5001
|
-
"dispute_lost",
|
|
5002
|
-
"dispute_accepted",
|
|
5003
|
-
"dispute_cancelled",
|
|
5004
|
-
"dispute_challenged",
|
|
5005
|
-
]),
|
|
5006
|
-
payment_id: stringType(),
|
|
5007
|
-
remarks: stringType().nullable(),
|
|
5008
|
-
}))
|
|
5009
|
-
.nullable(),
|
|
5010
|
-
error_code: stringType().nullable(),
|
|
5011
|
-
error_message: stringType().nullable(),
|
|
5012
|
-
metadata: recordType(anyType()).nullable(),
|
|
5013
|
-
payment_id: stringType(),
|
|
5014
|
-
payment_link: stringType().nullable(),
|
|
5015
|
-
payment_method: stringType().nullable(),
|
|
5016
|
-
payment_method_type: stringType().nullable(),
|
|
5017
|
-
product_cart: arrayType(objectType({
|
|
5018
|
-
product_id: stringType(),
|
|
5019
|
-
quantity: numberType(),
|
|
5020
|
-
}))
|
|
5021
|
-
.nullable(),
|
|
5022
|
-
refunds: arrayType(objectType({
|
|
5023
|
-
amount: numberType(),
|
|
5024
|
-
business_id: stringType(),
|
|
5025
|
-
created_at: stringType().transform(function (d) { return new Date(d); }),
|
|
5026
|
-
currency: stringType(),
|
|
5027
|
-
is_partial: booleanType(),
|
|
5028
|
-
payment_id: stringType(),
|
|
5029
|
-
reason: stringType().nullable(),
|
|
5030
|
-
refund_id: stringType(),
|
|
5031
|
-
status: enumType(["succeeded", "failed", "pending"]),
|
|
5032
|
-
}))
|
|
5033
|
-
.nullable(),
|
|
5034
|
-
settlement_amount: numberType(),
|
|
5035
|
-
settlement_currency: stringType(),
|
|
5036
|
-
settlement_tax: numberType().nullable(),
|
|
5037
|
-
status: enumType(["succeeded", "failed", "pending", "processing", "cancelled"]),
|
|
5038
|
-
subscription_id: stringType().nullable(),
|
|
5039
|
-
tax: numberType().nullable(),
|
|
5040
|
-
total_amount: numberType(),
|
|
5041
|
-
updated_at: stringType()
|
|
5042
|
-
.transform(function (d) { return new Date(d); })
|
|
5043
|
-
.nullable(),
|
|
5044
|
-
});
|
|
5045
|
-
var SubscriptionSchema = objectType({
|
|
5046
|
-
payload_type: literalType("Subscription"),
|
|
5047
|
-
addons: arrayType(objectType({
|
|
5048
|
-
addon_id: stringType(),
|
|
5049
|
-
quantity: numberType(),
|
|
5050
|
-
}))
|
|
5051
|
-
.nullable(),
|
|
5052
|
-
billing: objectType({
|
|
5053
|
-
city: stringType().nullable(),
|
|
5054
|
-
country: stringType().nullable(),
|
|
5055
|
-
state: stringType().nullable(),
|
|
5056
|
-
street: stringType().nullable(),
|
|
5057
|
-
zipcode: stringType().nullable(),
|
|
5058
|
-
}),
|
|
5059
|
-
cancel_at_next_billing_date: booleanType(),
|
|
5060
|
-
cancelled_at: stringType()
|
|
5061
|
-
.transform(function (d) { return new Date(d); })
|
|
5062
|
-
.nullable(),
|
|
5063
|
-
created_at: stringType().transform(function (d) { return new Date(d); }),
|
|
5064
|
-
currency: stringType(),
|
|
5065
|
-
customer: objectType({
|
|
5066
|
-
customer_id: stringType(),
|
|
5067
|
-
email: stringType(),
|
|
5068
|
-
name: stringType().nullable(),
|
|
5069
|
-
}),
|
|
5070
|
-
discount_id: stringType().nullable(),
|
|
5071
|
-
metadata: recordType(anyType()).nullable(),
|
|
5072
|
-
next_billing_date: stringType()
|
|
5073
|
-
.transform(function (d) { return new Date(d); })
|
|
5074
|
-
.nullable(),
|
|
5075
|
-
on_demand: booleanType(),
|
|
5076
|
-
payment_frequency_count: numberType(),
|
|
5077
|
-
payment_frequency_interval: enumType(["Day", "Week", "Month", "Year"]),
|
|
5078
|
-
previous_billing_date: stringType()
|
|
5079
|
-
.transform(function (d) { return new Date(d); })
|
|
5080
|
-
.nullable(),
|
|
5081
|
-
product_id: stringType(),
|
|
5082
|
-
quantity: numberType(),
|
|
5083
|
-
recurring_pre_tax_amount: numberType(),
|
|
5084
|
-
status: enumType([
|
|
5085
|
-
"pending",
|
|
5086
|
-
"active",
|
|
5087
|
-
"on_hold",
|
|
5088
|
-
"paused",
|
|
5089
|
-
"cancelled",
|
|
5090
|
-
"expired",
|
|
5091
|
-
"failed",
|
|
5092
|
-
]),
|
|
5093
|
-
subscription_id: stringType(),
|
|
5094
|
-
subscription_period_count: numberType(),
|
|
5095
|
-
subscription_period_interval: enumType(["Day", "Week", "Month", "Year"]),
|
|
5096
|
-
tax_inclusive: booleanType(),
|
|
5097
|
-
trial_period_days: numberType(),
|
|
5098
|
-
});
|
|
5099
|
-
var RefundSchema = objectType({
|
|
5100
|
-
payload_type: literalType("Refund"),
|
|
5101
|
-
amount: numberType(),
|
|
5102
|
-
business_id: stringType(),
|
|
5103
|
-
created_at: stringType().transform(function (d) { return new Date(d); }),
|
|
5104
|
-
currency: stringType(),
|
|
5105
|
-
is_partial: booleanType(),
|
|
5106
|
-
payment_id: stringType(),
|
|
5107
|
-
reason: stringType().nullable(),
|
|
5108
|
-
refund_id: stringType(),
|
|
5109
|
-
status: enumType(["succeeded", "failed", "pending"]),
|
|
5110
|
-
});
|
|
5111
|
-
var DisputeSchema = objectType({
|
|
5112
|
-
payload_type: literalType("Dispute"),
|
|
5113
|
-
amount: stringType(),
|
|
5114
|
-
business_id: stringType(),
|
|
5115
|
-
created_at: stringType().transform(function (d) { return new Date(d); }),
|
|
5116
|
-
currency: stringType(),
|
|
5117
|
-
dispute_id: stringType(),
|
|
5118
|
-
dispute_stage: enumType([
|
|
4964
|
+
payload_type: literalType("Payment"),
|
|
4965
|
+
billing: objectType({
|
|
4966
|
+
city: stringType().nullable(),
|
|
4967
|
+
country: stringType().nullable(),
|
|
4968
|
+
state: stringType().nullable(),
|
|
4969
|
+
street: stringType().nullable(),
|
|
4970
|
+
zipcode: stringType().nullable()
|
|
4971
|
+
}),
|
|
4972
|
+
brand_id: stringType(),
|
|
4973
|
+
business_id: stringType(),
|
|
4974
|
+
card_issuing_country: stringType().nullable(),
|
|
4975
|
+
card_last_four: stringType().nullable(),
|
|
4976
|
+
card_network: stringType().nullable(),
|
|
4977
|
+
card_type: stringType().nullable(),
|
|
4978
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
4979
|
+
currency: stringType(),
|
|
4980
|
+
customer: objectType({
|
|
4981
|
+
customer_id: stringType(),
|
|
4982
|
+
email: stringType(),
|
|
4983
|
+
name: stringType().nullable()
|
|
4984
|
+
}),
|
|
4985
|
+
digital_products_delivered: booleanType(),
|
|
4986
|
+
discount_id: stringType().nullable(),
|
|
4987
|
+
disputes: arrayType(
|
|
4988
|
+
objectType({
|
|
4989
|
+
amount: stringType(),
|
|
4990
|
+
business_id: stringType(),
|
|
4991
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
4992
|
+
currency: stringType(),
|
|
4993
|
+
dispute_id: stringType(),
|
|
4994
|
+
dispute_stage: enumType([
|
|
5119
4995
|
"pre_dispute",
|
|
5120
4996
|
"dispute_opened",
|
|
5121
4997
|
"dispute_won",
|
|
5122
|
-
"dispute_lost"
|
|
5123
|
-
|
|
5124
|
-
|
|
4998
|
+
"dispute_lost"
|
|
4999
|
+
]),
|
|
5000
|
+
dispute_status: enumType([
|
|
5125
5001
|
"dispute_opened",
|
|
5126
5002
|
"dispute_won",
|
|
5127
5003
|
"dispute_lost",
|
|
5128
5004
|
"dispute_accepted",
|
|
5129
5005
|
"dispute_cancelled",
|
|
5130
|
-
"dispute_challenged"
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5006
|
+
"dispute_challenged"
|
|
5007
|
+
]),
|
|
5008
|
+
payment_id: stringType(),
|
|
5009
|
+
remarks: stringType().nullable()
|
|
5010
|
+
})
|
|
5011
|
+
).nullable(),
|
|
5012
|
+
error_code: stringType().nullable(),
|
|
5013
|
+
error_message: stringType().nullable(),
|
|
5014
|
+
metadata: recordType(anyType()).nullable(),
|
|
5015
|
+
payment_id: stringType(),
|
|
5016
|
+
payment_link: stringType().nullable(),
|
|
5017
|
+
payment_method: stringType().nullable(),
|
|
5018
|
+
payment_method_type: stringType().nullable(),
|
|
5019
|
+
product_cart: arrayType(
|
|
5020
|
+
objectType({
|
|
5021
|
+
product_id: stringType(),
|
|
5022
|
+
quantity: numberType()
|
|
5023
|
+
})
|
|
5024
|
+
).nullable(),
|
|
5025
|
+
refunds: arrayType(
|
|
5026
|
+
objectType({
|
|
5027
|
+
amount: numberType(),
|
|
5028
|
+
business_id: stringType(),
|
|
5029
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
5030
|
+
currency: stringType(),
|
|
5031
|
+
is_partial: booleanType(),
|
|
5032
|
+
payment_id: stringType(),
|
|
5033
|
+
reason: stringType().nullable(),
|
|
5034
|
+
refund_id: stringType(),
|
|
5035
|
+
status: enumType(["succeeded", "failed", "pending"])
|
|
5036
|
+
})
|
|
5037
|
+
).nullable(),
|
|
5038
|
+
settlement_amount: numberType(),
|
|
5039
|
+
settlement_currency: stringType(),
|
|
5040
|
+
settlement_tax: numberType().nullable(),
|
|
5041
|
+
status: enumType(["succeeded", "failed", "pending", "processing", "cancelled"]),
|
|
5042
|
+
subscription_id: stringType().nullable(),
|
|
5043
|
+
tax: numberType().nullable(),
|
|
5044
|
+
total_amount: numberType(),
|
|
5045
|
+
updated_at: stringType().transform((d) => new Date(d)).nullable()
|
|
5134
5046
|
});
|
|
5135
|
-
var
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5047
|
+
var SubscriptionSchema = objectType({
|
|
5048
|
+
payload_type: literalType("Subscription"),
|
|
5049
|
+
addons: arrayType(
|
|
5050
|
+
objectType({
|
|
5051
|
+
addon_id: stringType(),
|
|
5052
|
+
quantity: numberType()
|
|
5053
|
+
})
|
|
5054
|
+
).nullable(),
|
|
5055
|
+
billing: objectType({
|
|
5056
|
+
city: stringType().nullable(),
|
|
5057
|
+
country: stringType().nullable(),
|
|
5058
|
+
state: stringType().nullable(),
|
|
5059
|
+
street: stringType().nullable(),
|
|
5060
|
+
zipcode: stringType().nullable()
|
|
5061
|
+
}),
|
|
5062
|
+
cancel_at_next_billing_date: booleanType(),
|
|
5063
|
+
cancelled_at: stringType().transform((d) => new Date(d)).nullable(),
|
|
5064
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
5065
|
+
currency: stringType(),
|
|
5066
|
+
customer: objectType({
|
|
5140
5067
|
customer_id: stringType(),
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5068
|
+
email: stringType(),
|
|
5069
|
+
name: stringType().nullable()
|
|
5070
|
+
}),
|
|
5071
|
+
discount_id: stringType().nullable(),
|
|
5072
|
+
metadata: recordType(anyType()).nullable(),
|
|
5073
|
+
next_billing_date: stringType().transform((d) => new Date(d)).nullable(),
|
|
5074
|
+
on_demand: booleanType(),
|
|
5075
|
+
payment_frequency_count: numberType(),
|
|
5076
|
+
payment_frequency_interval: enumType(["Day", "Week", "Month", "Year"]),
|
|
5077
|
+
previous_billing_date: stringType().transform((d) => new Date(d)).nullable(),
|
|
5078
|
+
product_id: stringType(),
|
|
5079
|
+
quantity: numberType(),
|
|
5080
|
+
recurring_pre_tax_amount: numberType(),
|
|
5081
|
+
status: enumType([
|
|
5082
|
+
"pending",
|
|
5083
|
+
"active",
|
|
5084
|
+
"on_hold",
|
|
5085
|
+
"paused",
|
|
5086
|
+
"cancelled",
|
|
5087
|
+
"expired",
|
|
5088
|
+
"failed"
|
|
5089
|
+
]),
|
|
5090
|
+
subscription_id: stringType(),
|
|
5091
|
+
subscription_period_count: numberType(),
|
|
5092
|
+
subscription_period_interval: enumType(["Day", "Week", "Month", "Year"]),
|
|
5093
|
+
tax_inclusive: booleanType(),
|
|
5094
|
+
trial_period_days: numberType()
|
|
5095
|
+
});
|
|
5096
|
+
var RefundSchema = objectType({
|
|
5097
|
+
payload_type: literalType("Refund"),
|
|
5098
|
+
amount: numberType(),
|
|
5099
|
+
business_id: stringType(),
|
|
5100
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
5101
|
+
currency: stringType(),
|
|
5102
|
+
is_partial: booleanType(),
|
|
5103
|
+
payment_id: stringType(),
|
|
5104
|
+
reason: stringType().nullable(),
|
|
5105
|
+
refund_id: stringType(),
|
|
5106
|
+
status: enumType(["succeeded", "failed", "pending"])
|
|
5107
|
+
});
|
|
5108
|
+
var DisputeSchema = objectType({
|
|
5109
|
+
payload_type: literalType("Dispute"),
|
|
5110
|
+
amount: stringType(),
|
|
5111
|
+
business_id: stringType(),
|
|
5112
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
5113
|
+
currency: stringType(),
|
|
5114
|
+
dispute_id: stringType(),
|
|
5115
|
+
dispute_stage: enumType([
|
|
5116
|
+
"pre_dispute",
|
|
5117
|
+
"dispute_opened",
|
|
5118
|
+
"dispute_won",
|
|
5119
|
+
"dispute_lost"
|
|
5120
|
+
]),
|
|
5121
|
+
dispute_status: enumType([
|
|
5122
|
+
"dispute_opened",
|
|
5123
|
+
"dispute_won",
|
|
5124
|
+
"dispute_lost",
|
|
5125
|
+
"dispute_accepted",
|
|
5126
|
+
"dispute_cancelled",
|
|
5127
|
+
"dispute_challenged"
|
|
5128
|
+
]),
|
|
5129
|
+
payment_id: stringType(),
|
|
5130
|
+
remarks: stringType().nullable()
|
|
5131
|
+
});
|
|
5132
|
+
var LicenseKeySchema = objectType({
|
|
5133
|
+
payload_type: literalType("LicenseKey"),
|
|
5134
|
+
activations_limit: numberType(),
|
|
5135
|
+
business_id: stringType(),
|
|
5136
|
+
created_at: stringType().transform((d) => new Date(d)),
|
|
5137
|
+
customer_id: stringType(),
|
|
5138
|
+
expires_at: stringType().transform((d) => new Date(d)).nullable(),
|
|
5139
|
+
id: stringType(),
|
|
5140
|
+
instances_count: numberType(),
|
|
5141
|
+
key: stringType(),
|
|
5142
|
+
payment_id: stringType(),
|
|
5143
|
+
product_id: stringType(),
|
|
5144
|
+
status: enumType(["active", "inactive", "expired"]),
|
|
5145
|
+
subscription_id: stringType().nullable()
|
|
5151
5146
|
});
|
|
5152
5147
|
var PaymentSucceededPayloadSchema = objectType({
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5148
|
+
business_id: stringType(),
|
|
5149
|
+
type: literalType("payment.succeeded"),
|
|
5150
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5151
|
+
data: PaymentSchema
|
|
5157
5152
|
});
|
|
5158
5153
|
var PaymentFailedPayloadSchema = objectType({
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5154
|
+
business_id: stringType(),
|
|
5155
|
+
type: literalType("payment.failed"),
|
|
5156
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5157
|
+
data: PaymentSchema
|
|
5163
5158
|
});
|
|
5164
5159
|
var PaymentProcessingPayloadSchema = objectType({
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5160
|
+
business_id: stringType(),
|
|
5161
|
+
type: literalType("payment.processing"),
|
|
5162
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5163
|
+
data: PaymentSchema
|
|
5169
5164
|
});
|
|
5170
5165
|
var PaymentCancelledPayloadSchema = objectType({
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5166
|
+
business_id: stringType(),
|
|
5167
|
+
type: literalType("payment.cancelled"),
|
|
5168
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5169
|
+
data: PaymentSchema
|
|
5175
5170
|
});
|
|
5176
5171
|
var RefundSucceededPayloadSchema = objectType({
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5172
|
+
business_id: stringType(),
|
|
5173
|
+
type: literalType("refund.succeeded"),
|
|
5174
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5175
|
+
data: RefundSchema
|
|
5181
5176
|
});
|
|
5182
5177
|
var RefundFailedPayloadSchema = objectType({
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5178
|
+
business_id: stringType(),
|
|
5179
|
+
type: literalType("refund.failed"),
|
|
5180
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5181
|
+
data: RefundSchema
|
|
5187
5182
|
});
|
|
5188
5183
|
var DisputeOpenedPayloadSchema = objectType({
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5184
|
+
business_id: stringType(),
|
|
5185
|
+
type: literalType("dispute.opened"),
|
|
5186
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5187
|
+
data: DisputeSchema
|
|
5193
5188
|
});
|
|
5194
5189
|
var DisputeExpiredPayloadSchema = objectType({
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5190
|
+
business_id: stringType(),
|
|
5191
|
+
type: literalType("dispute.expired"),
|
|
5192
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5193
|
+
data: DisputeSchema
|
|
5199
5194
|
});
|
|
5200
5195
|
var DisputeAcceptedPayloadSchema = objectType({
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5196
|
+
business_id: stringType(),
|
|
5197
|
+
type: literalType("dispute.accepted"),
|
|
5198
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5199
|
+
data: DisputeSchema
|
|
5205
5200
|
});
|
|
5206
5201
|
var DisputeCancelledPayloadSchema = objectType({
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5202
|
+
business_id: stringType(),
|
|
5203
|
+
type: literalType("dispute.cancelled"),
|
|
5204
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5205
|
+
data: DisputeSchema
|
|
5211
5206
|
});
|
|
5212
5207
|
var DisputeChallengedPayloadSchema = objectType({
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5208
|
+
business_id: stringType(),
|
|
5209
|
+
type: literalType("dispute.challenged"),
|
|
5210
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5211
|
+
data: DisputeSchema
|
|
5217
5212
|
});
|
|
5218
5213
|
var DisputeWonPayloadSchema = objectType({
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5214
|
+
business_id: stringType(),
|
|
5215
|
+
type: literalType("dispute.won"),
|
|
5216
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5217
|
+
data: DisputeSchema
|
|
5223
5218
|
});
|
|
5224
5219
|
var DisputeLostPayloadSchema = objectType({
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5220
|
+
business_id: stringType(),
|
|
5221
|
+
type: literalType("dispute.lost"),
|
|
5222
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5223
|
+
data: DisputeSchema
|
|
5229
5224
|
});
|
|
5230
5225
|
var SubscriptionActivePayloadSchema = objectType({
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5226
|
+
business_id: stringType(),
|
|
5227
|
+
type: literalType("subscription.active"),
|
|
5228
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5229
|
+
data: SubscriptionSchema
|
|
5235
5230
|
});
|
|
5236
5231
|
var SubscriptionOnHoldPayloadSchema = objectType({
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5232
|
+
business_id: stringType(),
|
|
5233
|
+
type: literalType("subscription.on_hold"),
|
|
5234
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5235
|
+
data: SubscriptionSchema
|
|
5241
5236
|
});
|
|
5242
5237
|
var SubscriptionRenewedPayloadSchema = objectType({
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5238
|
+
business_id: stringType(),
|
|
5239
|
+
type: literalType("subscription.renewed"),
|
|
5240
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5241
|
+
data: SubscriptionSchema
|
|
5247
5242
|
});
|
|
5248
5243
|
var SubscriptionPausedPayloadSchema = objectType({
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5244
|
+
business_id: stringType(),
|
|
5245
|
+
type: literalType("subscription.paused"),
|
|
5246
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5247
|
+
data: SubscriptionSchema
|
|
5253
5248
|
});
|
|
5254
5249
|
var SubscriptionPlanChangedPayloadSchema = objectType({
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5250
|
+
business_id: stringType(),
|
|
5251
|
+
type: literalType("subscription.plan_changed"),
|
|
5252
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5253
|
+
data: SubscriptionSchema
|
|
5259
5254
|
});
|
|
5260
5255
|
var SubscriptionCancelledPayloadSchema = objectType({
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5256
|
+
business_id: stringType(),
|
|
5257
|
+
type: literalType("subscription.cancelled"),
|
|
5258
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5259
|
+
data: SubscriptionSchema
|
|
5265
5260
|
});
|
|
5266
5261
|
var SubscriptionFailedPayloadSchema = objectType({
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5262
|
+
business_id: stringType(),
|
|
5263
|
+
type: literalType("subscription.failed"),
|
|
5264
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5265
|
+
data: SubscriptionSchema
|
|
5271
5266
|
});
|
|
5272
5267
|
var SubscriptionExpiredPayloadSchema = objectType({
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5268
|
+
business_id: stringType(),
|
|
5269
|
+
type: literalType("subscription.expired"),
|
|
5270
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5271
|
+
data: SubscriptionSchema
|
|
5277
5272
|
});
|
|
5278
5273
|
var LicenseKeyCreatedPayloadSchema = objectType({
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5274
|
+
business_id: stringType(),
|
|
5275
|
+
type: literalType("license_key.created"),
|
|
5276
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
5277
|
+
data: LicenseKeySchema
|
|
5283
5278
|
});
|
|
5284
5279
|
var WebhookPayloadSchema = discriminatedUnionType("type", [
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5280
|
+
PaymentSucceededPayloadSchema,
|
|
5281
|
+
PaymentFailedPayloadSchema,
|
|
5282
|
+
PaymentProcessingPayloadSchema,
|
|
5283
|
+
PaymentCancelledPayloadSchema,
|
|
5284
|
+
RefundSucceededPayloadSchema,
|
|
5285
|
+
RefundFailedPayloadSchema,
|
|
5286
|
+
DisputeOpenedPayloadSchema,
|
|
5287
|
+
DisputeExpiredPayloadSchema,
|
|
5288
|
+
DisputeAcceptedPayloadSchema,
|
|
5289
|
+
DisputeCancelledPayloadSchema,
|
|
5290
|
+
DisputeChallengedPayloadSchema,
|
|
5291
|
+
DisputeWonPayloadSchema,
|
|
5292
|
+
DisputeLostPayloadSchema,
|
|
5293
|
+
SubscriptionActivePayloadSchema,
|
|
5294
|
+
SubscriptionOnHoldPayloadSchema,
|
|
5295
|
+
SubscriptionRenewedPayloadSchema,
|
|
5296
|
+
SubscriptionPausedPayloadSchema,
|
|
5297
|
+
SubscriptionPlanChangedPayloadSchema,
|
|
5298
|
+
SubscriptionCancelledPayloadSchema,
|
|
5299
|
+
SubscriptionFailedPayloadSchema,
|
|
5300
|
+
SubscriptionExpiredPayloadSchema,
|
|
5301
|
+
LicenseKeyCreatedPayloadSchema
|
|
5307
5302
|
]);
|
|
5308
5303
|
|
|
5309
5304
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -6157,220 +6152,108 @@ class Webhook {
|
|
|
6157
6152
|
Webhook_1 = dist.Webhook = Webhook;
|
|
6158
6153
|
Webhook.prefix = "whsec_";
|
|
6159
6154
|
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6166
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6167
|
-
});
|
|
6168
|
-
};
|
|
6169
|
-
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
6170
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
6171
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
6172
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6173
|
-
function step(op) {
|
|
6174
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
6175
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
6176
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6177
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6178
|
-
switch (op[0]) {
|
|
6179
|
-
case 0: case 1: t = op; break;
|
|
6180
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
6181
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6182
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6183
|
-
default:
|
|
6184
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6185
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6186
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6187
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6188
|
-
if (t[2]) _.ops.pop();
|
|
6189
|
-
_.trys.pop(); continue;
|
|
6190
|
-
}
|
|
6191
|
-
op = body.call(thisArg, _);
|
|
6192
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6193
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6155
|
+
async function handleWebhookPayload(payload, config, context) {
|
|
6156
|
+
const callHandler = (handler, payload2) => {
|
|
6157
|
+
if (!handler) return;
|
|
6158
|
+
if (context !== void 0) {
|
|
6159
|
+
return handler(context, payload2);
|
|
6194
6160
|
}
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
return [4 /*yield*/, callHandler(config.onDisputeAccepted, payload)];
|
|
6267
|
-
case 19:
|
|
6268
|
-
_a.sent();
|
|
6269
|
-
_a.label = 20;
|
|
6270
|
-
case 20:
|
|
6271
|
-
if (!(payload.type === "dispute.cancelled")) return [3 /*break*/, 22];
|
|
6272
|
-
return [4 /*yield*/, callHandler(config.onDisputeCancelled, payload)];
|
|
6273
|
-
case 21:
|
|
6274
|
-
_a.sent();
|
|
6275
|
-
_a.label = 22;
|
|
6276
|
-
case 22:
|
|
6277
|
-
if (!(payload.type === "dispute.challenged")) return [3 /*break*/, 24];
|
|
6278
|
-
return [4 /*yield*/, callHandler(config.onDisputeChallenged, payload)];
|
|
6279
|
-
case 23:
|
|
6280
|
-
_a.sent();
|
|
6281
|
-
_a.label = 24;
|
|
6282
|
-
case 24:
|
|
6283
|
-
if (!(payload.type === "dispute.won")) return [3 /*break*/, 26];
|
|
6284
|
-
return [4 /*yield*/, callHandler(config.onDisputeWon, payload)];
|
|
6285
|
-
case 25:
|
|
6286
|
-
_a.sent();
|
|
6287
|
-
_a.label = 26;
|
|
6288
|
-
case 26:
|
|
6289
|
-
if (!(payload.type === "dispute.lost")) return [3 /*break*/, 28];
|
|
6290
|
-
return [4 /*yield*/, callHandler(config.onDisputeLost, payload)];
|
|
6291
|
-
case 27:
|
|
6292
|
-
_a.sent();
|
|
6293
|
-
_a.label = 28;
|
|
6294
|
-
case 28:
|
|
6295
|
-
if (!(payload.type === "subscription.active")) return [3 /*break*/, 30];
|
|
6296
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionActive, payload)];
|
|
6297
|
-
case 29:
|
|
6298
|
-
_a.sent();
|
|
6299
|
-
_a.label = 30;
|
|
6300
|
-
case 30:
|
|
6301
|
-
if (!(payload.type === "subscription.on_hold")) return [3 /*break*/, 32];
|
|
6302
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionOnHold, payload)];
|
|
6303
|
-
case 31:
|
|
6304
|
-
_a.sent();
|
|
6305
|
-
_a.label = 32;
|
|
6306
|
-
case 32:
|
|
6307
|
-
if (!(payload.type === "subscription.renewed")) return [3 /*break*/, 34];
|
|
6308
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionRenewed, payload)];
|
|
6309
|
-
case 33:
|
|
6310
|
-
_a.sent();
|
|
6311
|
-
_a.label = 34;
|
|
6312
|
-
case 34:
|
|
6313
|
-
if (!(payload.type === "subscription.paused")) return [3 /*break*/, 36];
|
|
6314
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionPaused, payload)];
|
|
6315
|
-
case 35:
|
|
6316
|
-
_a.sent();
|
|
6317
|
-
_a.label = 36;
|
|
6318
|
-
case 36:
|
|
6319
|
-
if (!(payload.type === "subscription.plan_changed")) return [3 /*break*/, 38];
|
|
6320
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionPlanChanged, payload)];
|
|
6321
|
-
case 37:
|
|
6322
|
-
_a.sent();
|
|
6323
|
-
_a.label = 38;
|
|
6324
|
-
case 38:
|
|
6325
|
-
if (!(payload.type === "subscription.cancelled")) return [3 /*break*/, 40];
|
|
6326
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionCancelled, payload)];
|
|
6327
|
-
case 39:
|
|
6328
|
-
_a.sent();
|
|
6329
|
-
_a.label = 40;
|
|
6330
|
-
case 40:
|
|
6331
|
-
if (!(payload.type === "subscription.failed")) return [3 /*break*/, 42];
|
|
6332
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionFailed, payload)];
|
|
6333
|
-
case 41:
|
|
6334
|
-
_a.sent();
|
|
6335
|
-
_a.label = 42;
|
|
6336
|
-
case 42:
|
|
6337
|
-
if (!(payload.type === "subscription.expired")) return [3 /*break*/, 44];
|
|
6338
|
-
return [4 /*yield*/, callHandler(config.onSubscriptionExpired, payload)];
|
|
6339
|
-
case 43:
|
|
6340
|
-
_a.sent();
|
|
6341
|
-
_a.label = 44;
|
|
6342
|
-
case 44:
|
|
6343
|
-
if (!(payload.type === "license_key.created")) return [3 /*break*/, 46];
|
|
6344
|
-
return [4 /*yield*/, callHandler(config.onLicenseKeyCreated, payload)];
|
|
6345
|
-
case 45:
|
|
6346
|
-
_a.sent();
|
|
6347
|
-
_a.label = 46;
|
|
6348
|
-
case 46: return [2 /*return*/];
|
|
6349
|
-
}
|
|
6350
|
-
});
|
|
6351
|
-
});
|
|
6161
|
+
return handler(payload2);
|
|
6162
|
+
};
|
|
6163
|
+
if (config.onPayload) {
|
|
6164
|
+
await callHandler(config.onPayload, payload);
|
|
6165
|
+
}
|
|
6166
|
+
if (payload.type === "payment.succeeded") {
|
|
6167
|
+
await callHandler(config.onPaymentSucceeded, payload);
|
|
6168
|
+
}
|
|
6169
|
+
if (payload.type === "payment.failed") {
|
|
6170
|
+
await callHandler(config.onPaymentFailed, payload);
|
|
6171
|
+
}
|
|
6172
|
+
if (payload.type === "payment.processing") {
|
|
6173
|
+
await callHandler(config.onPaymentProcessing, payload);
|
|
6174
|
+
}
|
|
6175
|
+
if (payload.type === "payment.cancelled") {
|
|
6176
|
+
await callHandler(config.onPaymentCancelled, payload);
|
|
6177
|
+
}
|
|
6178
|
+
if (payload.type === "refund.succeeded") {
|
|
6179
|
+
await callHandler(config.onRefundSucceeded, payload);
|
|
6180
|
+
}
|
|
6181
|
+
if (payload.type === "refund.failed") {
|
|
6182
|
+
await callHandler(config.onRefundFailed, payload);
|
|
6183
|
+
}
|
|
6184
|
+
if (payload.type === "dispute.opened") {
|
|
6185
|
+
await callHandler(config.onDisputeOpened, payload);
|
|
6186
|
+
}
|
|
6187
|
+
if (payload.type === "dispute.expired") {
|
|
6188
|
+
await callHandler(config.onDisputeExpired, payload);
|
|
6189
|
+
}
|
|
6190
|
+
if (payload.type === "dispute.accepted") {
|
|
6191
|
+
await callHandler(config.onDisputeAccepted, payload);
|
|
6192
|
+
}
|
|
6193
|
+
if (payload.type === "dispute.cancelled") {
|
|
6194
|
+
await callHandler(config.onDisputeCancelled, payload);
|
|
6195
|
+
}
|
|
6196
|
+
if (payload.type === "dispute.challenged") {
|
|
6197
|
+
await callHandler(config.onDisputeChallenged, payload);
|
|
6198
|
+
}
|
|
6199
|
+
if (payload.type === "dispute.won") {
|
|
6200
|
+
await callHandler(config.onDisputeWon, payload);
|
|
6201
|
+
}
|
|
6202
|
+
if (payload.type === "dispute.lost") {
|
|
6203
|
+
await callHandler(config.onDisputeLost, payload);
|
|
6204
|
+
}
|
|
6205
|
+
if (payload.type === "subscription.active") {
|
|
6206
|
+
await callHandler(config.onSubscriptionActive, payload);
|
|
6207
|
+
}
|
|
6208
|
+
if (payload.type === "subscription.on_hold") {
|
|
6209
|
+
await callHandler(config.onSubscriptionOnHold, payload);
|
|
6210
|
+
}
|
|
6211
|
+
if (payload.type === "subscription.renewed") {
|
|
6212
|
+
await callHandler(config.onSubscriptionRenewed, payload);
|
|
6213
|
+
}
|
|
6214
|
+
if (payload.type === "subscription.paused") {
|
|
6215
|
+
await callHandler(config.onSubscriptionPaused, payload);
|
|
6216
|
+
}
|
|
6217
|
+
if (payload.type === "subscription.plan_changed") {
|
|
6218
|
+
await callHandler(config.onSubscriptionPlanChanged, payload);
|
|
6219
|
+
}
|
|
6220
|
+
if (payload.type === "subscription.cancelled") {
|
|
6221
|
+
await callHandler(config.onSubscriptionCancelled, payload);
|
|
6222
|
+
}
|
|
6223
|
+
if (payload.type === "subscription.failed") {
|
|
6224
|
+
await callHandler(config.onSubscriptionFailed, payload);
|
|
6225
|
+
}
|
|
6226
|
+
if (payload.type === "subscription.expired") {
|
|
6227
|
+
await callHandler(config.onSubscriptionExpired, payload);
|
|
6228
|
+
}
|
|
6229
|
+
if (payload.type === "license_key.created") {
|
|
6230
|
+
await callHandler(config.onLicenseKeyCreated, payload);
|
|
6231
|
+
}
|
|
6352
6232
|
}
|
|
6353
|
-
var verifyWebhookPayload =
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6233
|
+
var verifyWebhookPayload = async ({
|
|
6234
|
+
webhookKey,
|
|
6235
|
+
headers,
|
|
6236
|
+
body
|
|
6237
|
+
}) => {
|
|
6238
|
+
const standardWebhook = new Webhook_1(webhookKey);
|
|
6239
|
+
try {
|
|
6240
|
+
standardWebhook.verify(body, headers);
|
|
6241
|
+
} catch (e) {
|
|
6242
|
+
if (e instanceof WebhookVerificationError_1) {
|
|
6243
|
+
throw new Error(e.message);
|
|
6244
|
+
}
|
|
6245
|
+
throw e;
|
|
6246
|
+
}
|
|
6247
|
+
const {
|
|
6248
|
+
success,
|
|
6249
|
+
data: payload,
|
|
6250
|
+
error
|
|
6251
|
+
} = WebhookPayloadSchema.safeParse(JSON.parse(body));
|
|
6252
|
+
if (!success) {
|
|
6253
|
+
throw new Error(error.message);
|
|
6254
|
+
}
|
|
6255
|
+
return payload;
|
|
6256
|
+
};
|
|
6374
6257
|
|
|
6375
6258
|
/**
|
|
6376
6259
|
* Creates a Convex HTTP action to securely handle Dodo Payments webhooks.
|