Skip to content

Commit

Permalink
feat(medusa-payment-stripe): Stripe PaymentProcessor implementation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored Feb 28, 2023
1 parent d61d6c7 commit 589d1c0
Show file tree
Hide file tree
Showing 55 changed files with 2,325 additions and 1,278 deletions.
7 changes: 7 additions & 0 deletions .changeset/eleven-cycles-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"medusa-payment-paypal": minor
"medusa-payment-stripe": minor
"@medusajs/medusa": minor
---

feat(medusa-payment-stripe): Implement payment processor API on stripe plugin and fix web hook issues
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jest*
packages/*
# List of packages to Lint
!packages/medusa
!packages/medusa-payment-stripe



Expand Down
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ module.exports = {
extends: ["plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./packages/medusa/tsconfig.json",
project: [
"./packages/medusa/tsconfig.json",
"./packages/medusa-payment-stripe/tsconfig.spec.json",
]
},
rules: {
"valid-jsdoc": "off",
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-payment-paypal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "medusa-payment-paypal",
"version": "1.2.10",
"description": "Paypal Payment provider for Meduas Commerce",
"description": "Paypal Payment provider for Medusa Commerce",
"main": "index.js",
"repository": {
"type": "git",
Expand Down
14 changes: 0 additions & 14 deletions packages/medusa-payment-stripe/.babelrc

This file was deleted.

14 changes: 1 addition & 13 deletions packages/medusa-payment-stripe/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
/lib
dist
node_modules
.DS_store
.env*
/*.js
!index.js
yarn.lock

/dist

/api
/services
/models
/subscribers
/helpers
/__mocks__
8 changes: 0 additions & 8 deletions packages/medusa-payment-stripe/.npmignore

This file was deleted.

10 changes: 9 additions & 1 deletion packages/medusa-payment-stripe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@ Learn more about how you can use this plugin in the [documentaion](https://docs.
{
api_key: "STRIPE_API_KEY",
webhook_secret: "STRIPE_WEBHOOK_SECRET",
automatic_payment_methods: true

// automatic_payment_methods: true,

// This description will be used if the cart context does not provide one.
// payment_description: "custom description to apply",
}
```

## Automatic Payment Methods

If you wish to use [Stripe's automatic payment methods](https://stripe.com/docs/connect/automatic-payment-methods) set the `automatic_payment_methods` flag to true.

## Deprecation

The stripe plugin version `>=1.2.x` requires medusa `>=1.8.x`
1 change: 0 additions & 1 deletion packages/medusa-payment-stripe/index.js

This file was deleted.

13 changes: 13 additions & 0 deletions packages/medusa-payment-stripe/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
globals: {
"ts-jest": {
tsconfig: "tsconfig.spec.json",
isolatedModules: false,
},
},
transform: {
"^.+\\.[jt]s?$": "ts-jest",
},
testEnvironment: `node`,
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
}
41 changes: 16 additions & 25 deletions packages/medusa-payment-stripe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,37 @@
"name": "medusa-payment-stripe",
"version": "1.1.53",
"description": "Stripe Payment provider for Meduas Commerce",
"main": "index.js",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-payment-stripe"
},
"author": "Sebastian Rindom",
"files": [
"dist"
],
"author": "Medusa",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/node": "^7.7.4",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
"@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.9.6",
"client-sessions": "^0.8.0",
"cross-env": "^5.2.1",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.6",
"medusa-test-utils": "^1.1.37"
},
"scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests src",
"build": "babel src --out-dir . --ignore '**/__tests__','**/__mocks__'",
"watch": "babel -w src --out-dir . --ignore '**/__tests__','**/__mocks__'"
"build": "tsc",
"watch": "tsc --watch"
},
"devDependencies": {
"@medusajs/medusa": "^1.7.7",
"@types/stripe": "^8.0.417",
"cross-env": "^5.2.1",
"jest": "^25.5.4"
},
"peerDependencies": {
"medusa-interfaces": "1.3.6"
"@medusajs/medusa": "^1.7.7"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.39",
"stripe": "^8.50.0"
"medusa-core-utils": "^1.1.38",
"stripe": "^11.10.0"
},
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808",
"keywords": [
Expand Down
30 changes: 30 additions & 0 deletions packages/medusa-payment-stripe/src/__fixtures__/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export const PaymentIntentDataByStatus = {
REQUIRES_PAYMENT_METHOD: {
id: "requires_payment_method",
status: "requires_payment_method",
},
REQUIRES_CONFIRMATION: {
id: "requires_confirmation",
status: "requires_confirmation",
},
PROCESSING: {
id: "processing",
status: "processing",
},
REQUIRES_ACTION: {
id: "requires_action",
status: "requires_action",
},
CANCELED: {
id: "canceled",
status: "canceled",
},
REQUIRES_CAPTURE: {
id: "requires_capture",
status: "requires_capture",
},
SUCCEEDED: {
id: "succeeded",
status: "succeeded",
},
}
Loading

0 comments on commit 589d1c0

Please sign in to comment.