@storecraft/payments-stripe 1.0.15 → 1.0.17

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.
Files changed (2) hide show
  1. package/adapter.js +9 -14
  2. package/package.json +1 -1
package/adapter.js CHANGED
@@ -242,7 +242,7 @@ export class Stripe {
242
242
  }
243
243
 
244
244
  if(o) { // just an intent
245
- const date = new Date(o.created).toUTCString();
245
+ const date = new Date(o.created*1000).toUTCString();
246
246
  stat.messages = [
247
247
  `A payment intent of **${fmt(o.amount)}** was initiated at ${date}`,
248
248
  `The status is \`${o.status}\` and the ID is \`${o.id}\``
@@ -284,18 +284,10 @@ export class Stripe {
284
284
 
285
285
  let event;
286
286
 
287
- try {
288
- event = await this.stripe.webhooks.constructEventAsync(
289
- request.rawBody, sig, this.config.webhook_endpoint_secret, undefined,
290
- StripeCls.createSubtleCryptoProvider()
291
- );
292
- }
293
- catch (err) {
294
- response.status = 400;
295
- response.end();
296
- console.log(err.message);
297
- return;
298
- }
287
+ event = await this.stripe.webhooks.constructEventAsync(
288
+ request.rawBody, sig, this.config.webhook_endpoint_secret, undefined,
289
+ StripeCls.createSubtleCryptoProvider()
290
+ );
299
291
 
300
292
  let order_id;
301
293
  /** @type {StripeCls.PaymentIntent} */
@@ -329,9 +321,12 @@ export class Stripe {
329
321
  case 'charge.refunded':
330
322
  case 'charge.refund.updated':
331
323
  payment_status = PaymentOptionsEnum.refunded;
332
-
324
+ break;
333
325
  default: {
334
326
  console.log(`Unhandled event type ${event.type}`);
327
+
328
+
329
+
335
330
  return undefined;
336
331
  }
337
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/payments-stripe",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Official Storecraft <-> Stripe integration",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",