@paykit-sdk/gopay 1.1.2 → 1.1.3
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/gopay-provider.js +15 -17
- package/dist/gopay-provider.mjs +15 -17
- package/dist/index.js +17 -21
- package/dist/index.mjs +17 -21
- package/package.json +1 -1
package/dist/gopay-provider.js
CHANGED
|
@@ -4406,36 +4406,23 @@ var GoPayProvider = class extends core.AbstractPayKitProvider {
|
|
|
4406
4406
|
});
|
|
4407
4407
|
};
|
|
4408
4408
|
createCustomer = async (params) => {
|
|
4409
|
-
if (this.cloudClient) {
|
|
4410
|
-
return this.cloudClient.customers.create(params);
|
|
4411
|
-
}
|
|
4412
4409
|
throw new core.ProviderNotSupportedError("createCustomer", "gopay", {
|
|
4413
|
-
reason: "Gopay doesn't support creating customers
|
|
4410
|
+
reason: "Gopay doesn't support creating customers"
|
|
4414
4411
|
});
|
|
4415
4412
|
};
|
|
4416
4413
|
updateCustomer = async (id, params) => {
|
|
4417
|
-
if (this.cloudClient) {
|
|
4418
|
-
return this.cloudClient.customers.update(id, params);
|
|
4419
|
-
}
|
|
4420
4414
|
throw new core.ProviderNotSupportedError("updateCustomer", "gopay", {
|
|
4421
|
-
reason: "Gopay doesn't support updating customers
|
|
4415
|
+
reason: "Gopay doesn't support updating customers"
|
|
4422
4416
|
});
|
|
4423
4417
|
};
|
|
4424
4418
|
deleteCustomer = async (id) => {
|
|
4425
|
-
if (this.cloudClient) {
|
|
4426
|
-
this.cloudClient.customers.delete(id);
|
|
4427
|
-
return null;
|
|
4428
|
-
}
|
|
4429
4419
|
throw new core.ProviderNotSupportedError("deleteCustomer", "gopay", {
|
|
4430
|
-
reason: "Gopay doesn't support deleting customers
|
|
4420
|
+
reason: "Gopay doesn't support deleting customers"
|
|
4431
4421
|
});
|
|
4432
4422
|
};
|
|
4433
4423
|
retrieveCustomer = async (id) => {
|
|
4434
|
-
if (this.cloudClient) {
|
|
4435
|
-
return this.cloudClient.customers.retrieve(id);
|
|
4436
|
-
}
|
|
4437
4424
|
throw new core.ProviderNotSupportedError("retrieveCustomer", "gopay", {
|
|
4438
|
-
reason: "Gopay doesn't support retrieving customers
|
|
4425
|
+
reason: "Gopay doesn't support retrieving customers"
|
|
4439
4426
|
});
|
|
4440
4427
|
};
|
|
4441
4428
|
createSubscription = async (params) => {
|
|
@@ -4599,12 +4586,23 @@ var GoPayProvider = class extends core.AbstractPayKitProvider {
|
|
|
4599
4586
|
}
|
|
4600
4587
|
);
|
|
4601
4588
|
}
|
|
4589
|
+
const successUrl = data.provider_metadata?.success_url;
|
|
4590
|
+
if (!successUrl) {
|
|
4591
|
+
throw new core.ConfigurationError(
|
|
4592
|
+
"success_url is required, this is the URL to redirect the user to the success page after the payment is successful",
|
|
4593
|
+
{
|
|
4594
|
+
provider: this.providerName,
|
|
4595
|
+
missingKeys: ["success_url"]
|
|
4596
|
+
}
|
|
4597
|
+
);
|
|
4598
|
+
}
|
|
4602
4599
|
const goPayRequest = {
|
|
4603
4600
|
payer: {
|
|
4604
4601
|
allowed_payment_instruments: ["PAYMENT_CARD", "BANK_ACCOUNT"],
|
|
4605
4602
|
default_payment_instrument: "PAYMENT_CARD",
|
|
4606
4603
|
contact: { email: data.customer.email }
|
|
4607
4604
|
},
|
|
4605
|
+
callback: { return_url: successUrl, notification_url: this.opts.webhookUrl },
|
|
4608
4606
|
target: { type: "ACCOUNT", goid: parseInt(this.opts.goId) },
|
|
4609
4607
|
amount: data.amount,
|
|
4610
4608
|
currency: data.currency ?? "CZK",
|
package/dist/gopay-provider.mjs
CHANGED
|
@@ -4384,36 +4384,23 @@ var GoPayProvider = class extends AbstractPayKitProvider {
|
|
|
4384
4384
|
});
|
|
4385
4385
|
};
|
|
4386
4386
|
createCustomer = async (params) => {
|
|
4387
|
-
if (this.cloudClient) {
|
|
4388
|
-
return this.cloudClient.customers.create(params);
|
|
4389
|
-
}
|
|
4390
4387
|
throw new ProviderNotSupportedError("createCustomer", "gopay", {
|
|
4391
|
-
reason: "Gopay doesn't support creating customers
|
|
4388
|
+
reason: "Gopay doesn't support creating customers"
|
|
4392
4389
|
});
|
|
4393
4390
|
};
|
|
4394
4391
|
updateCustomer = async (id, params) => {
|
|
4395
|
-
if (this.cloudClient) {
|
|
4396
|
-
return this.cloudClient.customers.update(id, params);
|
|
4397
|
-
}
|
|
4398
4392
|
throw new ProviderNotSupportedError("updateCustomer", "gopay", {
|
|
4399
|
-
reason: "Gopay doesn't support updating customers
|
|
4393
|
+
reason: "Gopay doesn't support updating customers"
|
|
4400
4394
|
});
|
|
4401
4395
|
};
|
|
4402
4396
|
deleteCustomer = async (id) => {
|
|
4403
|
-
if (this.cloudClient) {
|
|
4404
|
-
this.cloudClient.customers.delete(id);
|
|
4405
|
-
return null;
|
|
4406
|
-
}
|
|
4407
4397
|
throw new ProviderNotSupportedError("deleteCustomer", "gopay", {
|
|
4408
|
-
reason: "Gopay doesn't support deleting customers
|
|
4398
|
+
reason: "Gopay doesn't support deleting customers"
|
|
4409
4399
|
});
|
|
4410
4400
|
};
|
|
4411
4401
|
retrieveCustomer = async (id) => {
|
|
4412
|
-
if (this.cloudClient) {
|
|
4413
|
-
return this.cloudClient.customers.retrieve(id);
|
|
4414
|
-
}
|
|
4415
4402
|
throw new ProviderNotSupportedError("retrieveCustomer", "gopay", {
|
|
4416
|
-
reason: "Gopay doesn't support retrieving customers
|
|
4403
|
+
reason: "Gopay doesn't support retrieving customers"
|
|
4417
4404
|
});
|
|
4418
4405
|
};
|
|
4419
4406
|
createSubscription = async (params) => {
|
|
@@ -4577,12 +4564,23 @@ var GoPayProvider = class extends AbstractPayKitProvider {
|
|
|
4577
4564
|
}
|
|
4578
4565
|
);
|
|
4579
4566
|
}
|
|
4567
|
+
const successUrl = data.provider_metadata?.success_url;
|
|
4568
|
+
if (!successUrl) {
|
|
4569
|
+
throw new ConfigurationError(
|
|
4570
|
+
"success_url is required, this is the URL to redirect the user to the success page after the payment is successful",
|
|
4571
|
+
{
|
|
4572
|
+
provider: this.providerName,
|
|
4573
|
+
missingKeys: ["success_url"]
|
|
4574
|
+
}
|
|
4575
|
+
);
|
|
4576
|
+
}
|
|
4580
4577
|
const goPayRequest = {
|
|
4581
4578
|
payer: {
|
|
4582
4579
|
allowed_payment_instruments: ["PAYMENT_CARD", "BANK_ACCOUNT"],
|
|
4583
4580
|
default_payment_instrument: "PAYMENT_CARD",
|
|
4584
4581
|
contact: { email: data.customer.email }
|
|
4585
4582
|
},
|
|
4583
|
+
callback: { return_url: successUrl, notification_url: this.opts.webhookUrl },
|
|
4586
4584
|
target: { type: "ACCOUNT", goid: parseInt(this.opts.goId) },
|
|
4587
4585
|
amount: data.amount,
|
|
4588
4586
|
currency: data.currency ?? "CZK",
|
package/dist/index.js
CHANGED
|
@@ -4406,36 +4406,23 @@ var GoPayProvider = class extends core.AbstractPayKitProvider {
|
|
|
4406
4406
|
});
|
|
4407
4407
|
};
|
|
4408
4408
|
createCustomer = async (params) => {
|
|
4409
|
-
if (this.cloudClient) {
|
|
4410
|
-
return this.cloudClient.customers.create(params);
|
|
4411
|
-
}
|
|
4412
4409
|
throw new core.ProviderNotSupportedError("createCustomer", "gopay", {
|
|
4413
|
-
reason: "Gopay doesn't support creating customers
|
|
4410
|
+
reason: "Gopay doesn't support creating customers"
|
|
4414
4411
|
});
|
|
4415
4412
|
};
|
|
4416
4413
|
updateCustomer = async (id, params) => {
|
|
4417
|
-
if (this.cloudClient) {
|
|
4418
|
-
return this.cloudClient.customers.update(id, params);
|
|
4419
|
-
}
|
|
4420
4414
|
throw new core.ProviderNotSupportedError("updateCustomer", "gopay", {
|
|
4421
|
-
reason: "Gopay doesn't support updating customers
|
|
4415
|
+
reason: "Gopay doesn't support updating customers"
|
|
4422
4416
|
});
|
|
4423
4417
|
};
|
|
4424
4418
|
deleteCustomer = async (id) => {
|
|
4425
|
-
if (this.cloudClient) {
|
|
4426
|
-
this.cloudClient.customers.delete(id);
|
|
4427
|
-
return null;
|
|
4428
|
-
}
|
|
4429
4419
|
throw new core.ProviderNotSupportedError("deleteCustomer", "gopay", {
|
|
4430
|
-
reason: "Gopay doesn't support deleting customers
|
|
4420
|
+
reason: "Gopay doesn't support deleting customers"
|
|
4431
4421
|
});
|
|
4432
4422
|
};
|
|
4433
4423
|
retrieveCustomer = async (id) => {
|
|
4434
|
-
if (this.cloudClient) {
|
|
4435
|
-
return this.cloudClient.customers.retrieve(id);
|
|
4436
|
-
}
|
|
4437
4424
|
throw new core.ProviderNotSupportedError("retrieveCustomer", "gopay", {
|
|
4438
|
-
reason: "Gopay doesn't support retrieving customers
|
|
4425
|
+
reason: "Gopay doesn't support retrieving customers"
|
|
4439
4426
|
});
|
|
4440
4427
|
};
|
|
4441
4428
|
createSubscription = async (params) => {
|
|
@@ -4599,12 +4586,23 @@ var GoPayProvider = class extends core.AbstractPayKitProvider {
|
|
|
4599
4586
|
}
|
|
4600
4587
|
);
|
|
4601
4588
|
}
|
|
4589
|
+
const successUrl = data.provider_metadata?.success_url;
|
|
4590
|
+
if (!successUrl) {
|
|
4591
|
+
throw new core.ConfigurationError(
|
|
4592
|
+
"success_url is required, this is the URL to redirect the user to the success page after the payment is successful",
|
|
4593
|
+
{
|
|
4594
|
+
provider: this.providerName,
|
|
4595
|
+
missingKeys: ["success_url"]
|
|
4596
|
+
}
|
|
4597
|
+
);
|
|
4598
|
+
}
|
|
4602
4599
|
const goPayRequest = {
|
|
4603
4600
|
payer: {
|
|
4604
4601
|
allowed_payment_instruments: ["PAYMENT_CARD", "BANK_ACCOUNT"],
|
|
4605
4602
|
default_payment_instrument: "PAYMENT_CARD",
|
|
4606
4603
|
contact: { email: data.customer.email }
|
|
4607
4604
|
},
|
|
4605
|
+
callback: { return_url: successUrl, notification_url: this.opts.webhookUrl },
|
|
4608
4606
|
target: { type: "ACCOUNT", goid: parseInt(this.opts.goId) },
|
|
4609
4607
|
amount: data.amount,
|
|
4610
4608
|
currency: data.currency ?? "CZK",
|
|
@@ -4937,10 +4935,9 @@ var gopay = () => {
|
|
|
4937
4935
|
"GOPAY_CLIENT_SECRET",
|
|
4938
4936
|
"GOPAY_GO_ID",
|
|
4939
4937
|
"GOPAY_SANDBOX",
|
|
4940
|
-
"GOPAY_WEBHOOK_URL"
|
|
4941
|
-
"PAYKIT_CLOUD_API_KEY"
|
|
4938
|
+
"GOPAY_WEBHOOK_URL"
|
|
4942
4939
|
],
|
|
4943
|
-
process.env ?? {
|
|
4940
|
+
process.env ?? {},
|
|
4944
4941
|
"Missing required environment variables: {keys}"
|
|
4945
4942
|
);
|
|
4946
4943
|
return createGopay({
|
|
@@ -4949,7 +4946,6 @@ var gopay = () => {
|
|
|
4949
4946
|
goId: envVars.GOPAY_GO_ID,
|
|
4950
4947
|
isSandbox: envVars.GOPAY_SANDBOX === "true",
|
|
4951
4948
|
webhookUrl: envVars.GOPAY_WEBHOOK_URL,
|
|
4952
|
-
cloudApiKey: envVars.PAYKIT_CLOUD_API_KEY,
|
|
4953
4949
|
debug: true
|
|
4954
4950
|
});
|
|
4955
4951
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -4384,36 +4384,23 @@ var GoPayProvider = class extends AbstractPayKitProvider {
|
|
|
4384
4384
|
});
|
|
4385
4385
|
};
|
|
4386
4386
|
createCustomer = async (params) => {
|
|
4387
|
-
if (this.cloudClient) {
|
|
4388
|
-
return this.cloudClient.customers.create(params);
|
|
4389
|
-
}
|
|
4390
4387
|
throw new ProviderNotSupportedError("createCustomer", "gopay", {
|
|
4391
|
-
reason: "Gopay doesn't support creating customers
|
|
4388
|
+
reason: "Gopay doesn't support creating customers"
|
|
4392
4389
|
});
|
|
4393
4390
|
};
|
|
4394
4391
|
updateCustomer = async (id, params) => {
|
|
4395
|
-
if (this.cloudClient) {
|
|
4396
|
-
return this.cloudClient.customers.update(id, params);
|
|
4397
|
-
}
|
|
4398
4392
|
throw new ProviderNotSupportedError("updateCustomer", "gopay", {
|
|
4399
|
-
reason: "Gopay doesn't support updating customers
|
|
4393
|
+
reason: "Gopay doesn't support updating customers"
|
|
4400
4394
|
});
|
|
4401
4395
|
};
|
|
4402
4396
|
deleteCustomer = async (id) => {
|
|
4403
|
-
if (this.cloudClient) {
|
|
4404
|
-
this.cloudClient.customers.delete(id);
|
|
4405
|
-
return null;
|
|
4406
|
-
}
|
|
4407
4397
|
throw new ProviderNotSupportedError("deleteCustomer", "gopay", {
|
|
4408
|
-
reason: "Gopay doesn't support deleting customers
|
|
4398
|
+
reason: "Gopay doesn't support deleting customers"
|
|
4409
4399
|
});
|
|
4410
4400
|
};
|
|
4411
4401
|
retrieveCustomer = async (id) => {
|
|
4412
|
-
if (this.cloudClient) {
|
|
4413
|
-
return this.cloudClient.customers.retrieve(id);
|
|
4414
|
-
}
|
|
4415
4402
|
throw new ProviderNotSupportedError("retrieveCustomer", "gopay", {
|
|
4416
|
-
reason: "Gopay doesn't support retrieving customers
|
|
4403
|
+
reason: "Gopay doesn't support retrieving customers"
|
|
4417
4404
|
});
|
|
4418
4405
|
};
|
|
4419
4406
|
createSubscription = async (params) => {
|
|
@@ -4577,12 +4564,23 @@ var GoPayProvider = class extends AbstractPayKitProvider {
|
|
|
4577
4564
|
}
|
|
4578
4565
|
);
|
|
4579
4566
|
}
|
|
4567
|
+
const successUrl = data.provider_metadata?.success_url;
|
|
4568
|
+
if (!successUrl) {
|
|
4569
|
+
throw new ConfigurationError(
|
|
4570
|
+
"success_url is required, this is the URL to redirect the user to the success page after the payment is successful",
|
|
4571
|
+
{
|
|
4572
|
+
provider: this.providerName,
|
|
4573
|
+
missingKeys: ["success_url"]
|
|
4574
|
+
}
|
|
4575
|
+
);
|
|
4576
|
+
}
|
|
4580
4577
|
const goPayRequest = {
|
|
4581
4578
|
payer: {
|
|
4582
4579
|
allowed_payment_instruments: ["PAYMENT_CARD", "BANK_ACCOUNT"],
|
|
4583
4580
|
default_payment_instrument: "PAYMENT_CARD",
|
|
4584
4581
|
contact: { email: data.customer.email }
|
|
4585
4582
|
},
|
|
4583
|
+
callback: { return_url: successUrl, notification_url: this.opts.webhookUrl },
|
|
4586
4584
|
target: { type: "ACCOUNT", goid: parseInt(this.opts.goId) },
|
|
4587
4585
|
amount: data.amount,
|
|
4588
4586
|
currency: data.currency ?? "CZK",
|
|
@@ -4915,10 +4913,9 @@ var gopay = () => {
|
|
|
4915
4913
|
"GOPAY_CLIENT_SECRET",
|
|
4916
4914
|
"GOPAY_GO_ID",
|
|
4917
4915
|
"GOPAY_SANDBOX",
|
|
4918
|
-
"GOPAY_WEBHOOK_URL"
|
|
4919
|
-
"PAYKIT_CLOUD_API_KEY"
|
|
4916
|
+
"GOPAY_WEBHOOK_URL"
|
|
4920
4917
|
],
|
|
4921
|
-
process.env ?? {
|
|
4918
|
+
process.env ?? {},
|
|
4922
4919
|
"Missing required environment variables: {keys}"
|
|
4923
4920
|
);
|
|
4924
4921
|
return createGopay({
|
|
@@ -4927,7 +4924,6 @@ var gopay = () => {
|
|
|
4927
4924
|
goId: envVars.GOPAY_GO_ID,
|
|
4928
4925
|
isSandbox: envVars.GOPAY_SANDBOX === "true",
|
|
4929
4926
|
webhookUrl: envVars.GOPAY_WEBHOOK_URL,
|
|
4930
|
-
cloudApiKey: envVars.PAYKIT_CLOUD_API_KEY,
|
|
4931
4927
|
debug: true
|
|
4932
4928
|
});
|
|
4933
4929
|
};
|