New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

medusa-payment-stripe

Package Overview
Dependencies
Maintainers
2
Versions
838
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medusa-payment-stripe - npm Package Compare versions

Comparing version 1.1.40-next.0 to 1.1.40

README.md

9

__mocks__/cart.js

@@ -10,4 +10,2 @@ "use strict";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var carts = {

@@ -56,3 +54,3 @@ emptyCart: {

quantity: 10
}, _defineProperty({
}, {
id: _medusaTestUtils.IdMap.getId("existingLine"),

@@ -70,3 +68,3 @@ title: "merge line",

quantity: 1
}, "quantity", 10)],
}],
shipping_methods: [{

@@ -97,3 +95,4 @@ id: _medusaTestUtils.IdMap.getId("freeShipping"),

discounts: [],
customer_id: _medusaTestUtils.IdMap.getId("lebron")
customer_id: _medusaTestUtils.IdMap.getId("lebron"),
context: {}
},

@@ -100,0 +99,0 @@ frCartNoStripeCustomer: {

@@ -31,3 +31,4 @@ "use strict";

amount: 100,
customer: "cus_123456789_new"
customer: "cus_123456789_new",
description: data === null || data === void 0 ? void 0 : data.description
});

@@ -40,3 +41,4 @@ }

amount: 100,
customer: "cus_lebron"
customer: "cus_lebron",
description: data === null || data === void 0 ? void 0 : data.description
});

@@ -43,0 +45,0 @@ }

@@ -6,10 +6,24 @@ # Change Log

## [1.1.39](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.38...medusa-payment-stripe@1.1.39) (2022-04-27)
## [1.1.40](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.38...medusa-payment-stripe@1.1.40) (2022-06-19)
**Note:** Version bump only for package medusa-payment-stripe
### Features
* **medusa-payment-stripe:** Ability to add payment description and improve status resolution ([#1404](https://github.com/medusajs/medusa/issues/1404)) ([327614e](https://github.com/medusajs/medusa/commit/327614e126d57b1c53ca95b2298c8e4ec1dd34fb))
## [1.1.39](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.38...medusa-payment-stripe@1.1.39) (2022-05-31)
### Features
* **medusa-payment-stripe:** Ability to add payment description and improve status resolution ([#1404](https://github.com/medusajs/medusa/issues/1404)) ([327614e](https://github.com/medusajs/medusa/commit/327614e126d57b1c53ca95b2298c8e4ec1dd34fb))
## [1.1.38](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.37...medusa-payment-stripe@1.1.38) (2022-01-11)

@@ -16,0 +30,0 @@

{
"name": "medusa-payment-stripe",
"version": "1.1.40-next.0+b4e3e9b4",
"version": "1.1.40",
"description": "Stripe Payment provider for Meduas Commerce",

@@ -29,3 +29,3 @@ "main": "index.js",

"jest": "^25.5.2",
"medusa-test-utils": "^1.1.39-next.0+b4e3e9b4"
"medusa-test-utils": "^1.1.37"
},

@@ -44,6 +44,6 @@ "scripts": {

"express": "^4.17.1",
"medusa-core-utils": "^1.1.33-next.0+b4e3e9b4",
"medusa-core-utils": "^1.1.31",
"stripe": "^8.50.0"
},
"gitHead": "b4e3e9b404bb3defd06b00eec1607604b41cea3c"
"gitHead": "8e43ef2b3ac5c5b3ee4792cae89d30c20da348ac"
}

@@ -5,3 +5,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -29,5 +29,5 @@ Object.defineProperty(exports, "__esModule", {

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -237,2 +237,4 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var _createPayment = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(cart) {
var _cart$context$payment, _cart$context, _this$options;
var customer_id, region_id, email, region, currency_code, amount, intentRequest, _customer$metadata, customer, stripeCustomer, _stripeCustomer, paymentIntent;

@@ -258,2 +260,3 @@

amount: Math.round(amount),
description: (_cart$context$payment = cart === null || cart === void 0 ? void 0 : (_cart$context = cart.context) === null || _cart$context === void 0 ? void 0 : _cart$context.payment_description) !== null && _cart$context$payment !== void 0 ? _cart$context$payment : (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.payment_description,
currency: currency_code,

@@ -260,0 +263,0 @@ payment_method_types: ["bancontact"],

@@ -5,3 +5,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -29,5 +29,5 @@ Object.defineProperty(exports, "__esModule", {

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -237,2 +237,4 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var _createPayment = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(cart) {
var _cart$context$payment, _cart$context, _this$options;
var customer_id, region_id, email, region, currency_code, amount, intentRequest, _customer$metadata, customer, stripeCustomer, _stripeCustomer, paymentIntent;

@@ -258,2 +260,3 @@

amount: Math.round(amount),
description: (_cart$context$payment = cart === null || cart === void 0 ? void 0 : (_cart$context = cart.context) === null || _cart$context === void 0 ? void 0 : _cart$context.payment_description) !== null && _cart$context$payment !== void 0 ? _cart$context$payment : (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.payment_description,
currency: currency_code,

@@ -260,0 +263,0 @@ payment_method_types: ["giropay"],

@@ -5,3 +5,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -29,5 +29,5 @@ Object.defineProperty(exports, "__esModule", {

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -237,2 +237,4 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var _createPayment = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(cart) {
var _cart$context$payment, _cart$context, _this$options;
var customer_id, region_id, email, region, currency_code, amount, intentRequest, _customer$metadata, customer, stripeCustomer, _stripeCustomer, paymentIntent;

@@ -258,2 +260,3 @@

amount: Math.round(amount),
description: (_cart$context$payment = cart === null || cart === void 0 ? void 0 : (_cart$context = cart.context) === null || _cart$context === void 0 ? void 0 : _cart$context.payment_description) !== null && _cart$context$payment !== void 0 ? _cart$context$payment : (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.payment_description,
currency: currency_code,

@@ -260,0 +263,0 @@ payment_method_types: ["ideal"],

@@ -5,3 +5,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -13,4 +13,2 @@ Object.defineProperty(exports, "__esModule", {

var _lodash = _interopRequireDefault(require("lodash"));
var _stripe = _interopRequireDefault(require("stripe"));

@@ -20,7 +18,9 @@

var _dist = require("@medusajs/medusa/dist");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -35,5 +35,5 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -106,3 +106,3 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

var _getStatus = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(paymentData) {
var id, paymentIntent, status;
var id, paymentIntent;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -118,47 +118,22 @@ while (1) {

paymentIntent = _context.sent;
status = "pending";
_context.t0 = paymentIntent.status;
_context.next = _context.t0 === "requires_payment_method" ? 7 : _context.t0 === "requires_confirmation" ? 7 : _context.t0 === "processing" ? 7 : _context.t0 === "requires_action" ? 8 : _context.t0 === "canceled" ? 9 : _context.t0 === "requires_capture" ? 10 : _context.t0 === "succeeded" ? 10 : 11;
break;
if (!(paymentIntent.status === "requires_payment_method")) {
_context.next = 7;
break;
}
return _context.abrupt("return", status);
case 7:
if (!(paymentIntent.status === "requires_confirmation")) {
_context.next = 9;
break;
}
return _context.abrupt("return", _dist.PaymentSessionStatus.PENDING);
return _context.abrupt("return", status);
case 8:
return _context.abrupt("return", _dist.PaymentSessionStatus.REQUIRES_MORE);
case 9:
if (!(paymentIntent.status === "processing")) {
_context.next = 11;
break;
}
return _context.abrupt("return", _dist.PaymentSessionStatus.CANCELED);
return _context.abrupt("return", status);
case 10:
return _context.abrupt("return", _dist.PaymentSessionStatus.AUTHORIZED);
case 11:
if (paymentIntent.status === "requires_action") {
status = "requires_more";
}
return _context.abrupt("return", _dist.PaymentSessionStatus.PENDING);
if (paymentIntent.status === "canceled") {
status = "canceled";
}
if (paymentIntent.status === "requires_capture") {
status = "authorized";
}
if (paymentIntent.status === "succeeded") {
status = "authorized";
}
return _context.abrupt("return", status);
case 16:
case 12:
case "end":

@@ -331,4 +306,6 @@ return _context.stop();

var _createPayment = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(cart) {
var customer_id, region_id, email, _yield$this$regionSer, currency_code, amount, intentRequest, _customer$metadata, customer, stripeCustomer, _stripeCustomer, paymentIntent;
var _cart$context$payment, _cart$context, _this$options;
var customer_id, region_id, email, _yield$this$regionSer, currency_code, amount, intentRequest, _customer$metadata, customer, stripeCustomer, _stripeCustomer;
return regeneratorRuntime.wrap(function _callee5$(_context5) {

@@ -351,2 +328,3 @@ while (1) {

intentRequest = {
description: (_cart$context$payment = cart === null || cart === void 0 ? void 0 : (_cart$context = cart.context) === null || _cart$context === void 0 ? void 0 : _cart$context.payment_description) !== null && _cart$context$payment !== void 0 ? _cart$context$payment : (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.payment_description,
amount: Math.round(amount),

@@ -411,6 +389,5 @@ currency: currency_code,

case 29:
paymentIntent = _context5.sent;
return _context5.abrupt("return", paymentIntent);
return _context5.abrupt("return", _context5.sent);
case 31:
case 30:
case "end":

@@ -417,0 +394,0 @@ return _context5.stop();

@@ -18,3 +18,3 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

@@ -21,0 +21,0 @@ var CartSubscriber = /*#__PURE__*/function () {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc