@paykit-sdk/stripe 1.1.99 → 1.1.101
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/dist/index.js +6 -12
- package/dist/index.mjs +6 -12
- package/dist/stripe-provider.js +6 -12
- package/dist/stripe-provider.mjs +6 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4415,15 +4415,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4415
4415
|
method: "createPayment"
|
|
4416
4416
|
});
|
|
4417
4417
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4418
|
-
let customerId = customer;
|
|
4419
4418
|
if (typeof customer === "object") {
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
phone: "",
|
|
4424
|
-
metadata: {}
|
|
4419
|
+
throw new core.InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4420
|
+
provider: this.providerName,
|
|
4421
|
+
method: "createPayment"
|
|
4425
4422
|
});
|
|
4426
|
-
customerId = newCustomer.id;
|
|
4427
4423
|
}
|
|
4428
4424
|
const paymentMetadata = core.stringifyMetadataValues({
|
|
4429
4425
|
...rest.metadata,
|
|
@@ -4431,7 +4427,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4431
4427
|
[core.PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4432
4428
|
});
|
|
4433
4429
|
const customerWithDefaultPaymentMethod = await this.stripe.customers.retrieve(
|
|
4434
|
-
|
|
4430
|
+
customer,
|
|
4435
4431
|
{ expand: ["invoice_settings.default_payment_method"] }
|
|
4436
4432
|
);
|
|
4437
4433
|
if ("deleted" in customerWithDefaultPaymentMethod) {
|
|
@@ -4442,9 +4438,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4442
4438
|
}
|
|
4443
4439
|
let defaultPaymentMethod = customerWithDefaultPaymentMethod.invoice_settings?.default_payment_method;
|
|
4444
4440
|
if (!defaultPaymentMethod) {
|
|
4445
|
-
const paymentMethods = await this.stripe.paymentMethods.list({
|
|
4446
|
-
customer: customerId
|
|
4447
|
-
});
|
|
4441
|
+
const paymentMethods = await this.stripe.paymentMethods.list({ customer });
|
|
4448
4442
|
if (paymentMethods.data.length === 0) {
|
|
4449
4443
|
throw new core.ValidationError(
|
|
4450
4444
|
`Customer ${customer} has no payment methods. Add a payment method for the customer before creating a payment intent`,
|
|
@@ -4457,7 +4451,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4457
4451
|
currency: rest.currency,
|
|
4458
4452
|
amount: rest.amount,
|
|
4459
4453
|
metadata: paymentMetadata,
|
|
4460
|
-
customer
|
|
4454
|
+
customer,
|
|
4461
4455
|
capture_method,
|
|
4462
4456
|
confirm: true,
|
|
4463
4457
|
// automatically confirms the payment
|
package/dist/index.mjs
CHANGED
|
@@ -4409,15 +4409,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4409
4409
|
method: "createPayment"
|
|
4410
4410
|
});
|
|
4411
4411
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4412
|
-
let customerId = customer;
|
|
4413
4412
|
if (typeof customer === "object") {
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
phone: "",
|
|
4418
|
-
metadata: {}
|
|
4413
|
+
throw new InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4414
|
+
provider: this.providerName,
|
|
4415
|
+
method: "createPayment"
|
|
4419
4416
|
});
|
|
4420
|
-
customerId = newCustomer.id;
|
|
4421
4417
|
}
|
|
4422
4418
|
const paymentMetadata = stringifyMetadataValues({
|
|
4423
4419
|
...rest.metadata,
|
|
@@ -4425,7 +4421,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4425
4421
|
[PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4426
4422
|
});
|
|
4427
4423
|
const customerWithDefaultPaymentMethod = await this.stripe.customers.retrieve(
|
|
4428
|
-
|
|
4424
|
+
customer,
|
|
4429
4425
|
{ expand: ["invoice_settings.default_payment_method"] }
|
|
4430
4426
|
);
|
|
4431
4427
|
if ("deleted" in customerWithDefaultPaymentMethod) {
|
|
@@ -4436,9 +4432,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4436
4432
|
}
|
|
4437
4433
|
let defaultPaymentMethod = customerWithDefaultPaymentMethod.invoice_settings?.default_payment_method;
|
|
4438
4434
|
if (!defaultPaymentMethod) {
|
|
4439
|
-
const paymentMethods = await this.stripe.paymentMethods.list({
|
|
4440
|
-
customer: customerId
|
|
4441
|
-
});
|
|
4435
|
+
const paymentMethods = await this.stripe.paymentMethods.list({ customer });
|
|
4442
4436
|
if (paymentMethods.data.length === 0) {
|
|
4443
4437
|
throw new ValidationError(
|
|
4444
4438
|
`Customer ${customer} has no payment methods. Add a payment method for the customer before creating a payment intent`,
|
|
@@ -4451,7 +4445,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4451
4445
|
currency: rest.currency,
|
|
4452
4446
|
amount: rest.amount,
|
|
4453
4447
|
metadata: paymentMetadata,
|
|
4454
|
-
customer
|
|
4448
|
+
customer,
|
|
4455
4449
|
capture_method,
|
|
4456
4450
|
confirm: true,
|
|
4457
4451
|
// automatically confirms the payment
|
package/dist/stripe-provider.js
CHANGED
|
@@ -4415,15 +4415,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4415
4415
|
method: "createPayment"
|
|
4416
4416
|
});
|
|
4417
4417
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4418
|
-
let customerId = customer;
|
|
4419
4418
|
if (typeof customer === "object") {
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
phone: "",
|
|
4424
|
-
metadata: {}
|
|
4419
|
+
throw new core.InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4420
|
+
provider: this.providerName,
|
|
4421
|
+
method: "createPayment"
|
|
4425
4422
|
});
|
|
4426
|
-
customerId = newCustomer.id;
|
|
4427
4423
|
}
|
|
4428
4424
|
const paymentMetadata = core.stringifyMetadataValues({
|
|
4429
4425
|
...rest.metadata,
|
|
@@ -4431,7 +4427,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4431
4427
|
[core.PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4432
4428
|
});
|
|
4433
4429
|
const customerWithDefaultPaymentMethod = await this.stripe.customers.retrieve(
|
|
4434
|
-
|
|
4430
|
+
customer,
|
|
4435
4431
|
{ expand: ["invoice_settings.default_payment_method"] }
|
|
4436
4432
|
);
|
|
4437
4433
|
if ("deleted" in customerWithDefaultPaymentMethod) {
|
|
@@ -4442,9 +4438,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4442
4438
|
}
|
|
4443
4439
|
let defaultPaymentMethod = customerWithDefaultPaymentMethod.invoice_settings?.default_payment_method;
|
|
4444
4440
|
if (!defaultPaymentMethod) {
|
|
4445
|
-
const paymentMethods = await this.stripe.paymentMethods.list({
|
|
4446
|
-
customer: customerId
|
|
4447
|
-
});
|
|
4441
|
+
const paymentMethods = await this.stripe.paymentMethods.list({ customer });
|
|
4448
4442
|
if (paymentMethods.data.length === 0) {
|
|
4449
4443
|
throw new core.ValidationError(
|
|
4450
4444
|
`Customer ${customer} has no payment methods. Add a payment method for the customer before creating a payment intent`,
|
|
@@ -4457,7 +4451,7 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
|
|
|
4457
4451
|
currency: rest.currency,
|
|
4458
4452
|
amount: rest.amount,
|
|
4459
4453
|
metadata: paymentMetadata,
|
|
4460
|
-
customer
|
|
4454
|
+
customer,
|
|
4461
4455
|
capture_method,
|
|
4462
4456
|
confirm: true,
|
|
4463
4457
|
// automatically confirms the payment
|
package/dist/stripe-provider.mjs
CHANGED
|
@@ -4409,15 +4409,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4409
4409
|
method: "createPayment"
|
|
4410
4410
|
});
|
|
4411
4411
|
const { provider_metadata, customer, capture_method, ...rest } = data;
|
|
4412
|
-
let customerId = customer;
|
|
4413
4412
|
if (typeof customer === "object") {
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
phone: "",
|
|
4418
|
-
metadata: {}
|
|
4413
|
+
throw new InvalidTypeError("customer", "string (customer ID)", "object", {
|
|
4414
|
+
provider: this.providerName,
|
|
4415
|
+
method: "createPayment"
|
|
4419
4416
|
});
|
|
4420
|
-
customerId = newCustomer.id;
|
|
4421
4417
|
}
|
|
4422
4418
|
const paymentMetadata = stringifyMetadataValues({
|
|
4423
4419
|
...rest.metadata,
|
|
@@ -4425,7 +4421,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4425
4421
|
[PAYKIT_METADATA_KEY]: JSON.stringify({ itemId: data.item_id ?? null })
|
|
4426
4422
|
});
|
|
4427
4423
|
const customerWithDefaultPaymentMethod = await this.stripe.customers.retrieve(
|
|
4428
|
-
|
|
4424
|
+
customer,
|
|
4429
4425
|
{ expand: ["invoice_settings.default_payment_method"] }
|
|
4430
4426
|
);
|
|
4431
4427
|
if ("deleted" in customerWithDefaultPaymentMethod) {
|
|
@@ -4436,9 +4432,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4436
4432
|
}
|
|
4437
4433
|
let defaultPaymentMethod = customerWithDefaultPaymentMethod.invoice_settings?.default_payment_method;
|
|
4438
4434
|
if (!defaultPaymentMethod) {
|
|
4439
|
-
const paymentMethods = await this.stripe.paymentMethods.list({
|
|
4440
|
-
customer: customerId
|
|
4441
|
-
});
|
|
4435
|
+
const paymentMethods = await this.stripe.paymentMethods.list({ customer });
|
|
4442
4436
|
if (paymentMethods.data.length === 0) {
|
|
4443
4437
|
throw new ValidationError(
|
|
4444
4438
|
`Customer ${customer} has no payment methods. Add a payment method for the customer before creating a payment intent`,
|
|
@@ -4451,7 +4445,7 @@ var StripeProvider = class extends AbstractPayKitProvider {
|
|
|
4451
4445
|
currency: rest.currency,
|
|
4452
4446
|
amount: rest.amount,
|
|
4453
4447
|
metadata: paymentMetadata,
|
|
4454
|
-
customer
|
|
4448
|
+
customer,
|
|
4455
4449
|
capture_method,
|
|
4456
4450
|
confirm: true,
|
|
4457
4451
|
// automatically confirms the payment
|