@solvapay/server 1.0.0-preview.17 → 1.0.0-preview.18

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/edge.d.ts CHANGED
@@ -943,6 +943,7 @@ interface SolvaPay {
943
943
  agentRef: string;
944
944
  customerRef: string;
945
945
  planRef?: string;
946
+ returnUrl?: string;
946
947
  }): Promise<{
947
948
  sessionId: string;
948
949
  checkoutUrl: string;
@@ -1174,10 +1175,12 @@ declare function processPaymentCore(request: Request, body: {
1174
1175
  declare function createCheckoutSessionCore(request: Request, body: {
1175
1176
  agentRef: string;
1176
1177
  planRef?: string;
1178
+ returnUrl?: string;
1177
1179
  }, options?: {
1178
1180
  solvaPay?: SolvaPay;
1179
1181
  includeEmail?: boolean;
1180
1182
  includeName?: boolean;
1183
+ returnUrl?: string;
1181
1184
  }): Promise<{
1182
1185
  sessionId: string;
1183
1186
  checkoutUrl: string;
package/dist/edge.js CHANGED
@@ -1221,11 +1221,20 @@ async function createCheckoutSessionCore(request, body, options = {}) {
1221
1221
  return customerResult;
1222
1222
  }
1223
1223
  const customerRef = customerResult;
1224
+ let returnUrl = body.returnUrl || options.returnUrl;
1225
+ if (!returnUrl) {
1226
+ try {
1227
+ const url = new URL(request.url);
1228
+ returnUrl = url.origin;
1229
+ } catch (error) {
1230
+ }
1231
+ }
1224
1232
  const solvaPay = options.solvaPay || createSolvaPay();
1225
1233
  const session = await solvaPay.createCheckoutSession({
1226
1234
  agentRef: body.agentRef,
1227
1235
  customerRef,
1228
- planRef: body.planRef || void 0
1236
+ planRef: body.planRef || void 0,
1237
+ returnUrl
1229
1238
  });
1230
1239
  return {
1231
1240
  sessionId: session.sessionId,
package/dist/index.cjs CHANGED
@@ -5490,11 +5490,20 @@ async function createCheckoutSessionCore(request, body, options = {}) {
5490
5490
  return customerResult;
5491
5491
  }
5492
5492
  const customerRef = customerResult;
5493
+ let returnUrl = body.returnUrl || options.returnUrl;
5494
+ if (!returnUrl) {
5495
+ try {
5496
+ const url = new URL(request.url);
5497
+ returnUrl = url.origin;
5498
+ } catch (error) {
5499
+ }
5500
+ }
5493
5501
  const solvaPay = options.solvaPay || createSolvaPay();
5494
5502
  const session = await solvaPay.createCheckoutSession({
5495
5503
  agentRef: body.agentRef,
5496
5504
  customerRef,
5497
- planRef: body.planRef || void 0
5505
+ planRef: body.planRef || void 0,
5506
+ returnUrl
5498
5507
  });
5499
5508
  return {
5500
5509
  sessionId: session.sessionId,
package/dist/index.d.cts CHANGED
@@ -903,6 +903,7 @@ interface SolvaPay {
903
903
  agentRef: string;
904
904
  customerRef: string;
905
905
  planRef?: string;
906
+ returnUrl?: string;
906
907
  }): Promise<{
907
908
  sessionId: string;
908
909
  checkoutUrl: string;
@@ -1174,10 +1175,12 @@ declare function processPaymentCore(request: Request, body: {
1174
1175
  declare function createCheckoutSessionCore(request: Request, body: {
1175
1176
  agentRef: string;
1176
1177
  planRef?: string;
1178
+ returnUrl?: string;
1177
1179
  }, options?: {
1178
1180
  solvaPay?: SolvaPay;
1179
1181
  includeEmail?: boolean;
1180
1182
  includeName?: boolean;
1183
+ returnUrl?: string;
1181
1184
  }): Promise<{
1182
1185
  sessionId: string;
1183
1186
  checkoutUrl: string;
package/dist/index.d.ts CHANGED
@@ -903,6 +903,7 @@ interface SolvaPay {
903
903
  agentRef: string;
904
904
  customerRef: string;
905
905
  planRef?: string;
906
+ returnUrl?: string;
906
907
  }): Promise<{
907
908
  sessionId: string;
908
909
  checkoutUrl: string;
@@ -1174,10 +1175,12 @@ declare function processPaymentCore(request: Request, body: {
1174
1175
  declare function createCheckoutSessionCore(request: Request, body: {
1175
1176
  agentRef: string;
1176
1177
  planRef?: string;
1178
+ returnUrl?: string;
1177
1179
  }, options?: {
1178
1180
  solvaPay?: SolvaPay;
1179
1181
  includeEmail?: boolean;
1180
1182
  includeName?: boolean;
1183
+ returnUrl?: string;
1181
1184
  }): Promise<{
1182
1185
  sessionId: string;
1183
1186
  checkoutUrl: string;
package/dist/index.js CHANGED
@@ -1222,11 +1222,20 @@ async function createCheckoutSessionCore(request, body, options = {}) {
1222
1222
  return customerResult;
1223
1223
  }
1224
1224
  const customerRef = customerResult;
1225
+ let returnUrl = body.returnUrl || options.returnUrl;
1226
+ if (!returnUrl) {
1227
+ try {
1228
+ const url = new URL(request.url);
1229
+ returnUrl = url.origin;
1230
+ } catch (error) {
1231
+ }
1232
+ }
1225
1233
  const solvaPay = options.solvaPay || createSolvaPay();
1226
1234
  const session = await solvaPay.createCheckoutSession({
1227
1235
  agentRef: body.agentRef,
1228
1236
  customerRef,
1229
- planRef: body.planRef || void 0
1237
+ planRef: body.planRef || void 0,
1238
+ returnUrl
1230
1239
  });
1231
1240
  return {
1232
1241
  sessionId: session.sessionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/server",
3
- "version": "1.0.0-preview.17",
3
+ "version": "1.0.0-preview.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "sideEffects": false,
39
39
  "dependencies": {
40
- "@solvapay/core": "1.0.0-preview.17"
40
+ "@solvapay/core": "1.0.0-preview.18"
41
41
  },
42
42
  "peerDependencies": {
43
- "@solvapay/auth": "1.0.0-preview.17"
43
+ "@solvapay/auth": "1.0.0-preview.18"
44
44
  },
45
45
  "devDependencies": {
46
46
  "dotenv": "^17.2.3",
@@ -50,7 +50,7 @@
50
50
  "tsx": "^4.20.5",
51
51
  "typescript": "^5.5.4",
52
52
  "vitest": "^2.0.5",
53
- "@solvapay/auth": "1.0.0-preview.17",
53
+ "@solvapay/auth": "1.0.0-preview.18",
54
54
  "@solvapay/demo-services": "0.0.0",
55
55
  "@solvapay/test-utils": "0.0.0"
56
56
  },