@porulle/adapter-stripe 0.10.3 → 0.10.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAGL,KAAK,cAAc,EAMpB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;CACtC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CA4H3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAGL,KAAK,cAAc,EAMpB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;CACtC;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CAyI3E"}
package/dist/index.js CHANGED
@@ -18,8 +18,18 @@ export function stripePayment(options) {
18
18
  },
19
19
  automatic_payment_methods: {
20
20
  enabled: true,
21
+ allow_redirects: "never",
21
22
  },
22
- });
23
+ // Porulle's synchronous checkout reserves inventory and captures
24
+ // after order creation. With a token, confirm up to the
25
+ // requires_capture boundary; never send raw card data here.
26
+ capture_method: "manual",
27
+ ...(params.paymentMethodToken
28
+ ? { payment_method: params.paymentMethodToken, confirm: true }
29
+ : {}),
30
+ }, params.idempotencyKey
31
+ ? { idempotencyKey: params.idempotencyKey }
32
+ : undefined);
23
33
  return Ok({
24
34
  id: intent.id,
25
35
  status: intent.status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porulle/adapter-stripe",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "stripe": "^18.5.0",
15
- "@porulle/core": "0.10.3"
15
+ "@porulle/core": "0.10.5"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^24.5.2",
package/src/index.ts CHANGED
@@ -26,18 +26,31 @@ export function stripePayment(options: StripeAdapterOptions): PaymentAdapter {
26
26
 
27
27
  async createPaymentIntent(params): Promise<Result<PaymentIntent>> {
28
28
  try {
29
- const intent = await stripe.paymentIntents.create({
30
- amount: params.amount,
31
- currency: params.currency.toLowerCase(),
32
- metadata: {
33
- orderId: params.orderId,
34
- customerId: params.customerId ?? "",
35
- ...params.metadata,
29
+ const intent = await stripe.paymentIntents.create(
30
+ {
31
+ amount: params.amount,
32
+ currency: params.currency.toLowerCase(),
33
+ metadata: {
34
+ orderId: params.orderId,
35
+ customerId: params.customerId ?? "",
36
+ ...params.metadata,
37
+ },
38
+ automatic_payment_methods: {
39
+ enabled: true,
40
+ allow_redirects: "never",
41
+ },
42
+ // Porulle's synchronous checkout reserves inventory and captures
43
+ // after order creation. With a token, confirm up to the
44
+ // requires_capture boundary; never send raw card data here.
45
+ capture_method: "manual",
46
+ ...(params.paymentMethodToken
47
+ ? { payment_method: params.paymentMethodToken, confirm: true }
48
+ : {}),
36
49
  },
37
- automatic_payment_methods: {
38
- enabled: true,
39
- },
40
- });
50
+ params.idempotencyKey
51
+ ? { idempotencyKey: params.idempotencyKey }
52
+ : undefined,
53
+ );
41
54
 
42
55
  return Ok({
43
56
  id: intent.id,