Merge branch 'develop' into feat/disabling-of-notification

This commit is contained in:
--list
2021-06-24 08:51:45 +02:00
92 changed files with 1915 additions and 705 deletions

View File

@@ -1,13 +1,13 @@
let ignore = [`**/dist`]
let ignore = [`**/dist`];
// Jest needs to compile this code, but generally we don't want this copied
// to output folders
if (process.env.NODE_ENV !== `test`) {
ignore.push(`**/__tests__`)
ignore.push(`**/__tests__`);
}
module.exports = {
sourceMaps: true,
presets: ["babel-preset-medusa-package"],
ignore,
}
};

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.8](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.7...babel-preset-medusa-package@1.1.8) (2021-06-09)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.7](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.6...babel-preset-medusa-package@1.1.7) (2021-06-09)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.6](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.5...babel-preset-medusa-package@1.1.6) (2021-06-09)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.5](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.4...babel-preset-medusa-package@1.1.5) (2021-06-09)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.4](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.3...babel-preset-medusa-package@1.1.4) (2021-06-08)

View File

@@ -1,6 +1,6 @@
{
"name": "babel-preset-medusa-package",
"version": "1.1.4",
"version": "1.1.8",
"author": "Sebastian Rindom <sebastian@mrbltech.com>",
"repository": {
"type": "git",

View File

@@ -3,6 +3,74 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.9](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.8...@medusajs/medusa-cli@1.1.9) (2021-06-09)
### Bug Fixes
* better cli ([953747f](https://github.com/medusajs/medusa/commit/953747f3d2409cef82faf926ad316a384e6667b4))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
## [1.1.8](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.8...@medusajs/medusa-cli@1.1.8) (2021-06-09)
### Bug Fixes
* better cli ([953747f](https://github.com/medusajs/medusa/commit/953747f3d2409cef82faf926ad316a384e6667b4))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
## [1.1.7](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.8...@medusajs/medusa-cli@1.1.7) (2021-06-09)
### Bug Fixes
* better cli ([953747f](https://github.com/medusajs/medusa/commit/953747f3d2409cef82faf926ad316a384e6667b4))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
## [1.1.6](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.8...@medusajs/medusa-cli@1.1.6) (2021-06-09)
### Bug Fixes
* better cli ([953747f](https://github.com/medusajs/medusa/commit/953747f3d2409cef82faf926ad316a384e6667b4))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
## [1.1.5](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.8...@medusajs/medusa-cli@1.1.5) (2021-06-08)

View File

@@ -1,6 +1,6 @@
{
"name": "@medusajs/medusa-cli",
"version": "1.1.5",
"version": "1.1.9",
"description": "Command Line interface for Medusa Commerce",
"main": "dist/index.js",
"bin": {

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.13...medusa-core-utils@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-core-utils
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.12...medusa-core-utils@1.1.13) (2021-06-09)
**Note:** Version bump only for package medusa-core-utils
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.11...medusa-core-utils@1.1.12) (2021-06-09)
**Note:** Version bump only for package medusa-core-utils
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.10...medusa-core-utils@1.1.11) (2021-06-09)
**Note:** Version bump only for package medusa-core-utils
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.9...medusa-core-utils@1.1.10) (2021-06-08)
**Note:** Version bump only for package medusa-core-utils

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-core-utils",
"version": "1.1.10",
"version": "1.1.14",
"description": "Core utils for Medusa",
"main": "dist/index.js",
"repository": {

View File

@@ -0,0 +1,105 @@
import { transformIdableFields } from "../transform-idable-fields"
describe("transformIdableFields", () => {
test("one field", () => {
const test = {
shipping_address: "test_id",
}
const result = transformIdableFields(test, ["shipping_address"])
expect(test).toEqual(test)
expect(result).toEqual({
shipping_address_id: "test_id",
})
})
test("duplicate field", () => {
const test = {
shipping_address: "test_id",
shipping_address_id: "something else",
}
const result = transformIdableFields(test, ["shipping_address"])
expect(test).toEqual(test)
expect(result).toEqual({
shipping_address_id: "test_id",
})
})
test("many fields", () => {
const test = {
shipping_address: "test_id",
customer: "cus_test",
region: "reg_test",
something: "else",
}
const result = transformIdableFields(test, [
"shipping_address",
"customer",
"region",
])
expect(test).toEqual(test)
expect(result).toEqual({
shipping_address_id: "test_id",
customer_id: "cus_test",
region_id: "reg_test",
something: "else",
})
})
test("mix fields", () => {
const test = {
shipping_address: {
address_1: "my home",
},
customer: "cus_test",
region: "reg_test",
something: "else",
}
const result = transformIdableFields(test, [
"shipping_address",
"customer",
"region",
])
expect(test).toEqual(test)
expect(result).toEqual({
shipping_address: {
address_1: "my home",
},
customer_id: "cus_test",
region_id: "reg_test",
something: "else",
})
})
test("no fields", () => {
const test = {
something: "else",
and: "more",
maybe: "one more",
}
const result = transformIdableFields(test, [
"shipping_address",
"customer",
"region",
])
expect(test).toEqual(test)
expect(result).toEqual({
something: "else",
and: "more",
maybe: "one more",
})
})
})

View File

@@ -1,5 +1,6 @@
export { countries } from "./countries"
export { isoCountryLookup } from "./countries"
export { transformIdableFields } from "./transform-idable-fields"
export { default as Validator } from "./validator"
export { default as MedusaError } from "./errors"
export { default as getConfigFile } from "./get-config-file"

View File

@@ -0,0 +1,22 @@
/**
* Takes an object and a list of fields to tranform in that object. If the field
* exists on the object and its value is a string it will append `_id` to the
* field name. This is used when allowing API calls to hold either ID or object
* values in the payload. The method returns a new object with the
* transformation.
* @param {Object} obj - the object to transform
* @param {Array<String>} fields - the fields to apply transformation to
* @returns {Object} the transformed object
*/
export const transformIdableFields = (obj, fields) => {
const ret = { ...obj }
for (const key of fields) {
if (key in obj && typeof ret[key] === "string") {
ret[`${key}_id`] = ret[key]
delete ret[key]
}
}
return ret
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.0.13](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.12...medusa-dev-cli@0.0.13) (2021-06-09)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.12](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.11...medusa-dev-cli@0.0.12) (2021-06-09)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.11](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.10...medusa-dev-cli@0.0.11) (2021-06-09)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.10](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.9...medusa-dev-cli@0.0.10) (2021-06-09)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.9](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.8...medusa-dev-cli@0.0.9) (2021-06-08)

View File

@@ -1,7 +1,7 @@
{
"name": "medusa-dev-cli",
"description": "CLI helpers for contributors working on Medusa",
"version": "0.0.9",
"version": "0.0.13",
"author": "Sebastian Rindom <skrindom@gmail.com>",
"bin": {
"medusa-dev": "./dist/index.js"
@@ -24,7 +24,7 @@
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"babel-preset-medusa-package": "^1.1.4",
"babel-preset-medusa-package": "^1.1.8",
"cross-env": "^7.0.3"
},
"homepage": "https://github.com/medusajs/medusa/tree/master/packages/medusa-dev-cli#readme",

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.16...medusa-file-spaces@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.15...medusa-file-spaces@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.14...medusa-file-spaces@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.13...medusa-file-spaces@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.12...medusa-file-spaces@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-file-spaces

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-file-spaces",
"version": "1.1.13",
"version": "1.1.17",
"description": "Digital Ocean Spaces file connector for Medusa",
"main": "index.js",
"repository": {
@@ -40,8 +40,8 @@
"aws-sdk": "^2.710.0",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"stripe": "^8.50.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.13...medusa-fulfillment-manual@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.12...medusa-fulfillment-manual@1.1.13) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.11...medusa-fulfillment-manual@1.1.12) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.10...medusa-fulfillment-manual@1.1.11) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.9...medusa-fulfillment-manual@1.1.10) (2021-06-08)
**Note:** Version bump only for package medusa-fulfillment-manual

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-fulfillment-manual",
"version": "1.1.10",
"version": "1.1.14",
"description": "A manual fulfillment provider for Medusa",
"main": "index.js",
"repository": {
@@ -36,7 +36,7 @@
"@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/runtime": "^7.7.6",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -12,6 +12,10 @@ class ManualFulfillmentService extends FulfillmentService {
{
id: "manual-fulfillment",
},
{
id: "manual-fulfillment-return",
is_return: true,
},
]
}
@@ -36,6 +40,11 @@ class ManualFulfillmentService extends FulfillmentService {
return Promise.resolve({})
}
createReturn() {
// No data is being sent anywhere
return Promise.resolve({})
}
createFulfillment() {
// No data is being sent anywhere
return Promise.resolve({})

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.17...medusa-fulfillment-webshipper@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.16...medusa-fulfillment-webshipper@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.15...medusa-fulfillment-webshipper@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.14...medusa-fulfillment-webshipper@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.13...medusa-fulfillment-webshipper@1.1.14) (2021-06-08)
**Note:** Version bump only for package medusa-fulfillment-webshipper

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-fulfillment-webshipper",
"version": "1.1.14",
"version": "1.1.18",
"description": "Webshipper Fulfillment provider for Medusa",
"main": "index.js",
"repository": {
@@ -37,7 +37,7 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.14...medusa-interfaces@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-interfaces
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.13...medusa-interfaces@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-interfaces
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.12...medusa-interfaces@1.1.13) (2021-06-09)
**Note:** Version bump only for package medusa-interfaces
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.11...medusa-interfaces@1.1.12) (2021-06-09)
**Note:** Version bump only for package medusa-interfaces
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.10...medusa-interfaces@1.1.11) (2021-06-08)
**Note:** Version bump only for package medusa-interfaces

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-interfaces",
"version": "1.1.11",
"version": "1.1.15",
"description": "Core interfaces for Medusa",
"main": "dist/index.js",
"repository": {
@@ -35,7 +35,7 @@
"typeorm": "0.x"
},
"dependencies": {
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.16...medusa-payment-adyen@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.15...medusa-payment-adyen@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.14...medusa-payment-adyen@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.13...medusa-payment-adyen@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.12...medusa-payment-adyen@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-payment-adyen

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-adyen",
"version": "1.1.13",
"version": "1.1.17",
"description": "Adyen Payment provider for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -24,7 +24,7 @@
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.1.13"
"medusa-test-utils": "^1.1.17"
},
"scripts": {
"build": "babel src -d .",
@@ -42,7 +42,7 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -1,30 +0,0 @@
import { Router } from "express"
import cors from "cors"
import bodyParser from "body-parser"
import middlewares from "../../middlewares"
import { getConfigFile } from "medusa-core-utils"
const route = Router()
export default (app, rootDirectory) => {
const { configModule } = getConfigFile(rootDirectory, `medusa-config`)
const config = (configModule && configModule.projectConfig) || {}
const storeCors = config.store_cors || ""
route.use(
cors({
origin: storeCors.split(","),
credentials: true,
})
)
app.use("/adyen", route)
route.post(
"/payment-methods",
bodyParser.json(),
middlewares.wrap(require("./retrieve-payment-methods").default)
)
return app
}

View File

@@ -1,57 +0,0 @@
import { Validator, MedusaError } from "medusa-core-utils"
export default async (req, res) => {
const schema = Validator.object().keys({
cart_id: Validator.string().required(),
})
const { value, error } = schema.validate(req.body)
if (error) {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
try {
const adyenService = req.scope.resolve("adyenService")
const cartService = req.scope.resolve("cartService")
const cart = await cartService.retrieve(value.cart_id, {
select: ["total"],
relations: ["region", "region.payment_providers", "payment_sessions"],
})
const allowedMethods = cart.payment_sessions.map((ps) => {
if (ps.provider_id.includes("adyen")) {
return ps.provider_id.split("-adyen")[0]
}
})
if (allowedMethods.length === 0) {
res.status(200).json({ paymentMethods: {} })
return
}
const pmMethods = await adyenService.retrievePaymentMethods(
allowedMethods,
cart.total,
cart.currency_code,
cart.customer_id || ""
)
// Adyen does not behave 100% correctly in regards to allowed methods
// Therefore, we sanity filter before sending them to the storefront
const { paymentMethods, groups, storedPaymentMethods } = pmMethods
const methods = paymentMethods.filter((pm) =>
allowedMethods.includes(pm.type)
)
const response = {
paymentMethods: methods,
groups,
storedPaymentMethods,
}
res.status(200).json({ payment_methods: response })
} catch (err) {
throw err
}
}

View File

@@ -28,7 +28,7 @@ class AdyenService extends BaseService {
/** @private @constant {AxiosClient} */
this.adyenClient_ = this.initAdyenClient()
/** @private @constant {AdyenClient} */
/** @private @constant {AxiosClient} */
this.adyenPaymentApi = this.initPaymentClient()
}
@@ -51,16 +51,6 @@ class AdyenService extends BaseService {
return this.options_
}
initPaymentClient() {
return axios.create({
baseURL: this.options_.payment_endpoint,
headers: {
"Content-Type": "application/json",
"x-API-key": this.options_.api_key,
},
})
}
initAdyenClient() {
const config = new Config()
config.apiKey = this.options_.api_key
@@ -70,14 +60,22 @@ class AdyenService extends BaseService {
config,
})
client.setEnvironment(
this.options_.environment,
this.options_.live_endpoint_prefix
)
client.setEnvironment(this.options_.environment)
return client
}
initPaymentClient() {
return axios.create({
baseURL:
this.options_.payment_endpoint || "https://checkout-test.adyen.com/v67",
headers: {
"Content-Type": "application/json",
"x-API-key": this.options_.api_key,
},
})
}
/**
* Validates an Adyen webhook notification
* @param {object} notification - notification to validate
@@ -90,6 +88,7 @@ class AdyenService extends BaseService {
notification,
this.options_.notification_hmac
)
return validated
}
@@ -228,6 +227,10 @@ class AdyenService extends BaseService {
const status = this.getStatus(sessionData)
if (sessionData.resultCode === "RedirectShopper") {
return { data: sessionData, status: "requires_more" }
}
// If session data is present, we already called authorize once.
// Therefore, this is most likely a call for getting additional details
if (status === "requires_more") {
@@ -253,38 +256,28 @@ class AdyenService extends BaseService {
value: cart.total,
}
let paymentData = sessionData.paymentData
if (!paymentData) {
paymentData = {
paymentMethod: {
type: sessionData.type,
},
}
}
let request = {
amount,
merchantAccount: this.options_.merchant_account,
shopperIP: context.ip_address || "",
shopperReference: cart.customer_id,
paymentMethod: sessionData.paymentData.paymentMethod,
reference: cart.id,
merchantAccount: this.options_.merchant_account,
returnUrl: this.options_.return_url,
origin: this.options_.origin,
channel: "Web",
redirectFromIssuerMethod: "GET",
browserInfo: sessionData.browserInfo || {},
billingAddress: {
city: cart.shipping_address.city,
country: cart.shipping_address.country_code,
houseNumberOrName: cart.shipping_address.address_2 || "",
postalCode: cart.shipping_address.postal_code,
stateOrProvice: cart.shipping_address.province || "",
street: cart.shipping_address.address_1,
},
paymentMethod: paymentData.paymentMethod,
reference: cart.id,
metadata: {
cart_id: cart.id,
},
}
// If customer chose to save the payment method
if (sessionData.storePaymentMethod) {
request.storePaymentMethod = "true"
request.shopperInteraction = "Ecommerce"
request.recurringProcessingModel = "CardOnFile"
}
const checkout = new CheckoutAPI(this.adyenClient_)
try {
@@ -344,31 +337,34 @@ class AdyenService extends BaseService {
* @returns {string} status = processing_captures
*/
async capturePayment(payment) {
if (payment.captured_at !== null) {
return
}
const { pspReference, merchantReference } = payment.data
const { amount, currency_code } = payment
try {
const captured = await this.adyenPaymentApi.post("/capture", {
originalReference: pspReference,
modificationAmount: {
value: amount,
currency: currency_code.toUpperCase(),
},
merchantAccount: this.options_.merchant_account,
reference: merchantReference,
})
const captured = await this.adyenPaymentApi.post(
`/payments/${pspReference}/captures`,
{
merchantAccount: this.options_.merchant_account,
amount: {
value: amount,
currency: currency_code.toUpperCase(),
},
reference: merchantReference,
}
)
if (
captured.data.pspReference &&
captured.data.response !== "[capture-received]"
) {
if (captured.data.pspReference && captured.data.status !== "received") {
throw new MedusaError(
MedusaError.Types.INVALID_ARGUMENT,
"Could not process capture"
)
}
return { originalReference: pspReference, ...captured.data }
return { pspReference }
} catch (error) {
throw error
}
@@ -381,7 +377,7 @@ class AdyenService extends BaseService {
* @returns {object} payment data result of refund
*/
async refundPayment(payment, amountToRefund) {
const { originalReference, merchantReference } = payment.data
const { pspReference } = payment.data
const { currency_code } = payment
const refundAmount = {
@@ -390,14 +386,12 @@ class AdyenService extends BaseService {
}
try {
const refunded = await this.adyenPaymentApi.post("/refund", {
originalReference,
await this.adyenPaymentApi.post(`/payments/${pspReference}/refunds`, {
merchantAccount: this.options_.merchant_account,
modificationAmount: refundAmount,
reference: merchantReference,
amount: refundAmount,
})
return { originalReference, ...refunded.data }
return { pspReference }
} catch (error) {
throw error
}

View File

@@ -1,104 +0,0 @@
import _ from "lodash"
import https from "https"
import fs from "fs"
import axios from "axios"
import { PaymentService } from "medusa-interfaces"
class ApplePayAdyenService extends PaymentService {
static identifier = "applepay-adyen"
constructor({ adyenService }, options) {
super()
this.adyenService_ = adyenService
this.options_ = options
}
/**
* Status for Adyen payment.
* @param {Object} paymentData - payment method data from cart
* @returns {string} the status of the payment
*/
async getStatus(paymentData) {
const { resultCode } = paymentData
let status = "initial"
if (resultCode === "Authorised") {
status = "authorized"
}
return status
}
async createPayment(_) {
return {}
}
async getApplePaySession(validationUrl) {
let certificate
try {
// Place certificate in root folder
certificate = fs.readFileSync("./apple-pay-cert.pem")
} catch (error) {
throw new Error(
"Could not find ApplePay certificate. Make sure to place it in root folder of your server"
)
}
const httpsAgent = new https.Agent({
cert: certificate,
key: certificate,
rejectUnauthorized: false,
})
const request = {
merchantIdentifier: this.options_.applepay_merchant_id,
displayName: this.options_.applepay_display_name,
initiative: "web",
initiativeContext: this.options_.applepay_initiative_context,
}
return axios.post(validationUrl, request, {
httpsAgent,
})
}
async authorizePayment(sessionData, context) {
return this.adyenService_.authorizePayment(sessionData, context)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async retrievePayment(data) {
return this.adyenService_.retrievePayment(data)
}
async updatePaymentData(sessionData, update) {
return this.adyenService_.updatePaymentData(sessionData, update)
}
async updatePayment(data, _) {
return this.adyenService_.updatePayment(data)
}
async deletePayment(data) {
return this.adyenService_.deletePayment(data)
}
async capturePayment(data) {
return this.adyenService_.capturePayment(data)
}
async refundPayment(data, amountToRefund) {
return this.adyenService_.refundPayment(data, amountToRefund)
}
async cancelPayment(data) {
return this.adyenService_.cancelPayment(data)
}
}
export default ApplePayAdyenService

View File

@@ -1,62 +0,0 @@
import _ from "lodash"
import { PaymentService } from "medusa-interfaces"
class CardAdyenService extends PaymentService {
static identifier = "scheme-adyen"
constructor({ adyenService }) {
super()
this.adyenService_ = adyenService
}
async retrieveSavedMethods(customer) {
return this.adyenService_.retrieveSavedMethods(customer)
}
async getStatus(paymentData) {
return this.adyenService_.getStatus(paymentData)
}
async createPayment(data) {
return this.adyenService_.createPayment(data)
}
async authorizePayment(sessionData, context) {
return this.adyenService_.authorizePayment(sessionData, context)
}
async retrievePayment(data) {
return this.adyenService_.retrievePayment(data)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async updatePayment(data, _) {
return this.adyenService_.updatePayment(data)
}
async updatePaymentData(sessionData, update) {
return this.adyenService_.updatePaymentData(sessionData, update)
}
async deletePayment(data) {
return this.adyenService_.deletePayment(data)
}
async capturePayment(data) {
return this.adyenService_.capturePayment(data)
}
async refundPayment(data, amountToRefund) {
return this.adyenService_.refundPayment(data, amountToRefund)
}
async cancelPayment(data) {
return this.adyenService_.cancelPayment(data)
}
}
export default CardAdyenService

View File

@@ -1,58 +0,0 @@
import _ from "lodash"
import { PaymentService } from "medusa-interfaces"
class GooglePayAdyenService extends PaymentService {
static identifier = "paywithgoogle-adyen"
constructor({ adyenService }) {
super()
this.adyenService_ = adyenService
}
async getStatus(paymentData) {
return this.adyenService_.getStatus(paymentData)
}
async createPayment(data) {
return this.adyenService_.createPayment(data)
}
async authorizePayment(sessionData, context) {
return this.adyenService_.authorizePayment(sessionData, context)
}
async retrievePayment(data) {
return this.adyenService_.retrievePayment(data)
}
async updatePayment(data, _) {
return this.adyenService_.updatePayment(data)
}
async updatePaymentData(sessionData, update) {
return this.adyenService_.updatePaymentData(sessionData, update)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async deletePayment(data) {
return this.adyenService_.deletePayment(data)
}
async capturePayment(data) {
return this.adyenService_.capturePayment(data)
}
async refundPayment(data, amountToRefund) {
return this.adyenService_.refundPayment(data, amountToRefund)
}
async cancelPayment(data) {
return this.adyenService_.cancelPayment(data)
}
}
export default GooglePayAdyenService

View File

@@ -1,62 +0,0 @@
import _ from "lodash"
import { PaymentService } from "medusa-interfaces"
class IdealAdyenService extends PaymentService {
static identifier = "ideal-adyen"
constructor({ adyenService }) {
super()
this.adyenService_ = adyenService
}
async getStatus(paymentData) {
return this.adyenService_.getStatus(paymentData)
}
async createPayment(data) {
return this.adyenService_.createPayment(data)
}
async authorizePayment(sessionData, context) {
return this.adyenService_.authorizePayment(sessionData, context)
}
async retrievePayment(data) {
return this.adyenService_.retrievePayment(data)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async updatePayment(data, _) {
return this.adyenService_.updatePayment(data)
}
async updatePaymentData(sessionData, update) {
return this.adyenService_.updatePaymentData(sessionData, update)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async deletePayment(data) {
return this.adyenService_.deletePayment(data)
}
async capturePayment(data) {
return this.adyenService_.capturePayment(data)
}
async refundPayment(data, amountToRefund) {
return this.adyenService_.refundPayment(data, amountToRefund)
}
async cancelPayment(data) {
return this.adyenService_.cancelPayment(data)
}
}
export default IdealAdyenService

View File

@@ -15,7 +15,9 @@ class MobilePayAdyenService extends PaymentService {
}
async createPayment(data) {
return this.adyenService_.createPayment(data)
const raw = await this.adyenService_.createPayment(data)
raw.type = "mobilepay"
return raw
}
async authorizePayment(sessionData, context) {

View File

@@ -1,58 +0,0 @@
import _ from "lodash"
import { PaymentService } from "medusa-interfaces"
class PayPalAdyenService extends PaymentService {
static identifier = "paypal-adyen"
constructor({ adyenService }) {
super()
this.adyenService_ = adyenService
}
async getStatus(paymentData) {
return this.adyenService_.getStatus(paymentData)
}
async createPayment(data) {
return this.adyenService_.createPayment(data)
}
async authorizePayment(sessionData, context) {
return this.adyenService_.authorizePayment(sessionData, context)
}
async retrievePayment(data) {
return this.adyenService_.retrievePayment(data)
}
async getPaymentData(data) {
return this.adyenService_.getPaymentData(data)
}
async updatePayment(data, _) {
return this.adyenService_.updatePayment(data)
}
async updatePaymentData(sessionData, update) {
return this.adyenService_.updatePaymentData(sessionData, update)
}
async deletePayment(data) {
return this.adyenService_.deletePayment(data)
}
async capturePayment(data) {
return this.adyenService_.capturePayment(data)
}
async refundPayment(data, amountToRefund) {
return this.adyenService_.refundPayment(data, amountToRefund)
}
async cancelPayment(data) {
return this.adyenService_.cancelPayment(data)
}
}
export default PayPalAdyenService

View File

@@ -105,7 +105,6 @@ class AdyenSubscriber {
await this.paymentRepository_.save(updatedPayment)
} catch (error) {
console.log(error)
await this.manager_.transaction(async (manager) => {
const session = {
pspReference: notification.pspReference,

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.17...medusa-payment-klarna@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.16...medusa-payment-klarna@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.15...medusa-payment-klarna@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.14...medusa-payment-klarna@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.13...medusa-payment-klarna@1.1.14) (2021-06-08)
**Note:** Version bump only for package medusa-payment-klarna

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-klarna",
"version": "1.1.14",
"version": "1.1.18",
"description": "Klarna Payment provider for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -40,8 +40,8 @@
"axios": "^0.21.0",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13"
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -25,7 +25,6 @@ export default async (req, res) => {
if (shipping_address) {
const shippingAddress = {
...cart.shipping_address,
first_name: shipping_address.given_name,
last_name: shipping_address.family_name,
address_1: shipping_address.street_address,
@@ -47,13 +46,6 @@ export default async (req, res) => {
phone: shipping_address.phone,
}
if (cart.billing_address) {
billingAddress = {
...billingAddress,
...cart.billing_address,
}
}
await cartService.update(cart.id, {
shipping_address: shippingAddress,
billing_address: billingAddress,

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.18](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.17...medusa-payment-paypal@1.0.18) (2021-06-09)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.17](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.16...medusa-payment-paypal@1.0.17) (2021-06-09)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.16](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.15...medusa-payment-paypal@1.0.16) (2021-06-09)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.15](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.14...medusa-payment-paypal@1.0.15) (2021-06-09)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.14](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.13...medusa-payment-paypal@1.0.14) (2021-06-08)
**Note:** Version bump only for package medusa-payment-paypal

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-paypal",
"version": "1.0.14",
"version": "1.0.18",
"description": "Paypal Payment provider for Meduas Commerce",
"main": "index.js",
"repository": {
@@ -26,8 +26,8 @@
"cross-env": "^5.2.1",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-interfaces": "^1.1.11",
"medusa-test-utils": "^1.1.13"
"medusa-interfaces": "^1.1.15",
"medusa-test-utils": "^1.1.17"
},
"scripts": {
"build": "babel src -d . --ignore **/__tests__,**/__mocks__",
@@ -42,7 +42,7 @@
"@paypal/checkout-server-sdk": "^1.0.2",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.16...medusa-payment-stripe@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.15...medusa-payment-stripe@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.14...medusa-payment-stripe@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.13...medusa-payment-stripe@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.12...medusa-payment-stripe@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-payment-stripe

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-stripe",
"version": "1.1.13",
"version": "1.1.17",
"description": "Stripe Payment provider for Meduas Commerce",
"main": "index.js",
"repository": {
@@ -26,7 +26,7 @@
"cross-env": "^5.2.1",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.1.13"
"medusa-test-utils": "^1.1.17"
},
"scripts": {
"build": "babel src -d . --ignore **/__tests__",
@@ -40,7 +40,7 @@
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-core-utils": "^1.1.14",
"stripe": "^8.50.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -23,10 +23,8 @@ export default async (req, res) => {
// handle payment intent events
switch (event.type) {
case "payment_intent.succeeded":
if (order) {
await orderService.update(order.id, {
payment_status: "captured",
})
if (order && order.payment_status !== "captured") {
await orderService.capturePayment(order.id)
}
break
//case "payment_intent.canceled":
@@ -41,8 +39,9 @@ export default async (req, res) => {
break
case "payment_intent.amount_capturable_updated":
if (!order) {
const cart = await cartService.retrieve(cartId)
await orderService.createFromCart(cart)
await cartService.setPaymentSession(cartId, "stripe")
await cartService.authorizePayment(cartId)
await orderService.createFromCart(cartId)
}
break
default:

View File

@@ -0,0 +1,241 @@
import _ from "lodash"
import Stripe from "stripe"
import { PaymentService } from "medusa-interfaces"
class GiropayProviderService extends PaymentService {
static identifier = "stripe-giropay"
constructor(
{ stripeProviderService, customerService, totalsService, regionService },
options
) {
super()
/**
* Required Stripe options:
* {
* api_key: "stripe_secret_key", REQUIRED
* webhook_secret: "stripe_webhook_secret", REQUIRED
* // Use this flag to capture payment immediately (default is false)
* capture: true
* }
*/
this.options_ = options
/** @private @const {Stripe} */
this.stripe_ = Stripe(options.api_key)
/** @private @const {CustomerService} */
this.stripeProviderService_ = stripeProviderService
/** @private @const {CustomerService} */
this.customerService_ = customerService
/** @private @const {RegionService} */
this.regionService_ = regionService
/** @private @const {TotalsService} */
this.totalsService_ = totalsService
}
/**
* Fetches Stripe payment intent. Check its status and returns the
* corresponding Medusa status.
* @param {object} paymentData - payment method data from cart
* @returns {string} the status of the payment intent
*/
async getStatus(paymentData) {
return await this.stripeProviderService_.getStatus(paymentData)
}
/**
* Fetches a customers saved payment methods if registered in Stripe.
* @param {object} customer - customer to fetch saved cards for
* @returns {Promise<Array<object>>} saved payments methods
*/
async retrieveSavedMethods(customer) {
return Promise.resolve([])
}
/**
* Fetches a Stripe customer
* @param {string} customerId - Stripe customer id
* @returns {Promise<object>} Stripe customer
*/
async retrieveCustomer(customerId) {
return await this.stripeProviderService_.retrieveCustomer(customerId)
}
/**
* Creates a Stripe customer using a Medusa customer.
* @param {object} customer - Customer data from Medusa
* @returns {Promise<object>} Stripe customer
*/
async createCustomer(customer) {
return await this.stripeProviderService_.createCustomer(customer)
}
/**
* Creates a Stripe payment intent.
* If customer is not registered in Stripe, we do so.
* @param {object} cart - cart to create a payment for
* @returns {object} Stripe payment intent
*/
async createPayment(cart) {
const { customer_id, region_id, email } = cart
const region = await this.regionService_.retrieve(region_id)
const { currency_code } = region
const amount = await this.totalsService_.getTotal(cart)
const intentRequest = {
amount: Math.round(amount),
currency: currency_code,
payment_method_types: ["giropay"],
capture_method: "automatic",
metadata: { cart_id: `${cart.id}` },
}
if (customer_id) {
const customer = await this.customerService_.retrieve(customer_id)
if (customer.metadata?.stripe_id) {
intentRequest.customer = customer.metadata.stripe_id
} else {
const stripeCustomer = await this.createCustomer({
email,
id: customer_id,
})
intentRequest.customer = stripeCustomer.id
}
} else {
const stripeCustomer = await this.createCustomer({
email,
})
intentRequest.customer = stripeCustomer.id
}
const paymentIntent = await this.stripe_.paymentIntents.create(
intentRequest
)
return paymentIntent
}
/**
* Retrieves Stripe payment intent.
* @param {object} data - the data of the payment to retrieve
* @returns {Promise<object>} Stripe payment intent
*/
async retrievePayment(data) {
return await this.stripeProviderService_.retrievePayment(data)
}
/**
* Gets a Stripe payment intent and returns it.
* @param {object} sessionData - the data of the payment to retrieve
* @returns {Promise<object>} Stripe payment intent
*/
async getPaymentData(sessionData) {
return await this.stripeProviderService_.getPaymentData(sessionData)
}
/**
* Authorizes Stripe payment intent by simply returning
* the status for the payment intent in use.
* @param {object} sessionData - payment session data
* @param {object} context - properties relevant to current context
* @returns {Promise<{ status: string, data: object }>} result with data and status
*/
async authorizePayment(sessionData, context = {}) {
return await this.stripeProviderService_.authorizePayment(
sessionData,
context
)
}
async updatePaymentData(sessionData, update) {
return await this.stripeProviderService_.updatePaymentData(
sessionData,
update
)
}
/**
* Updates Stripe payment intent.
* @param {object} sessionData - payment session data.
* @param {object} update - objec to update intent with
* @returns {object} Stripe payment intent
*/
async updatePayment(sessionData, cart) {
try {
const stripeId = cart.customer?.metadata?.stripe_id || undefined
if (stripeId !== sessionData.customer) {
return this.createPayment(cart)
} else {
if (cart.total && sessionData.amount === Math.round(cart.total)) {
return sessionData
}
return this.stripe_.paymentIntents.update(sessionData.id, {
amount: Math.round(cart.total),
})
}
} catch (error) {
throw error
}
}
async deletePayment(payment) {
return await this.stripeProviderService_.deletePayment(payment)
}
/**
* Updates customer of Stripe payment intent.
* @param {string} paymentIntentId - id of payment intent to update
* @param {string} customerId - id of new Stripe customer
* @returns {object} Stripe payment intent
*/
async updatePaymentIntentCustomer(paymentIntentId, customerId) {
return await this.stripeProviderService_.updatePaymentIntentCustomer(
paymentIntentId,
customerId
)
}
/**
* Captures payment for Stripe payment intent.
* @param {object} paymentData - payment method data from cart
* @returns {object} Stripe payment intent
*/
async capturePayment(payment) {
return await this.stripeProviderService_.capturePayment(payment)
}
/**
* Refunds payment for Stripe payment intent.
* @param {object} paymentData - payment method data from cart
* @param {number} amountToRefund - amount to refund
* @returns {string} refunded payment intent
*/
async refundPayment(payment, amountToRefund) {
return await this.stripeProviderService_.refundPayment(
payment,
amountToRefund
)
}
/**
* Cancels payment for Stripe payment intent.
* @param {object} paymentData - payment method data from cart
* @returns {object} canceled payment intent
*/
async cancelPayment(payment) {
return await this.stripeProviderService_.cancelPayment(payment)
}
}
export default GiropayProviderService

View File

@@ -293,8 +293,14 @@ class StripeProviderService extends PaymentService {
async capturePayment(payment) {
const { id } = payment.data
try {
return this.stripe_.paymentIntents.capture(id)
const intent = await this.stripe_.paymentIntents.capture(id)
return intent
} catch (error) {
if (error.code === "payment_intent_unexpected_state") {
if (error.payment_intent.status === "succeeded") {
return error.payment_intent
}
}
throw error
}
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.16...medusa-plugin-add-ons@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.15...medusa-plugin-add-ons@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.14...medusa-plugin-add-ons@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.13...medusa-plugin-add-ons@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.12...medusa-plugin-add-ons@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-add-ons

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-add-ons",
"version": "1.1.13",
"version": "1.1.17",
"description": "Add-on plugin for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -25,7 +25,7 @@
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.1.13"
"medusa-test-utils": "^1.1.17"
},
"scripts": {
"build": "babel src -d . --ignore **/__tests__",
@@ -37,7 +37,7 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-core-utils": "^1.1.14",
"redis": "^3.0.2"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.19...medusa-plugin-brightpearl@1.1.20) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.18...medusa-plugin-brightpearl@1.1.19) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.17...medusa-plugin-brightpearl@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.16...medusa-plugin-brightpearl@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.15...medusa-plugin-brightpearl@1.1.16) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-brightpearl

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-brightpearl",
"version": "1.1.16",
"version": "1.1.20",
"description": "Brightpearl plugin for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -27,7 +27,7 @@
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.1.13",
"medusa-test-utils": "^1.1.17",
"prettier": "^2.0.5"
},
"scripts": {
@@ -43,7 +43,7 @@
"axios": "^0.19.2",
"axios-rate-limit": "^1.2.1",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-core-utils": "^1.1.14",
"randomatic": "^3.1.1"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.17...medusa-plugin-contentful@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-contentful
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.16...medusa-plugin-contentful@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-contentful
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.15...medusa-plugin-contentful@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-contentful
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.14...medusa-plugin-contentful@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-contentful
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.13...medusa-plugin-contentful@1.1.14) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-contentful

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-contentful",
"version": "1.1.14",
"version": "1.1.18",
"description": "Contentful plugin for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -39,8 +39,8 @@
"body-parser": "^1.19.0",
"contentful-management": "^5.27.1",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"redis": "^3.0.2"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -2,9 +2,17 @@ import _ from "lodash"
import { BaseService } from "medusa-interfaces"
import { createClient } from "contentful-management"
const IGNORE_THRESHOLD = 2 // seconds
class ContentfulService extends BaseService {
constructor(
{ productService, redisClient, productVariantService, eventBusService },
{
regionService,
productService,
redisClient,
productVariantService,
eventBusService,
},
options
) {
super()
@@ -13,6 +21,8 @@ class ContentfulService extends BaseService {
this.productVariantService_ = productVariantService
this.regionService_ = regionService
this.eventBus_ = eventBusService
this.options_ = options
@@ -24,16 +34,19 @@ class ContentfulService extends BaseService {
this.redis_ = redisClient
}
async getIgnoreIds_(type) {
return new Promise((resolve, reject) => {
this.redis_.get(`${type}_ignore_ids`, (err, reply) => {
if (err) {
return reject(err)
}
async addIgnore_(id, side) {
const key = `${id}_ignore_${side}`
return await this.redis_.set(
key,
1,
"EX",
this.options_.ignore_threshold || IGNORE_THRESHOLD
)
}
return resolve(JSON.parse(reply))
})
})
async shouldIgnore_(id, side) {
const key = `${id}_ignore_${side}`
return await this.redis_.get(key)
}
async getContentfulEnvironment_() {
@@ -46,12 +59,17 @@ class ContentfulService extends BaseService {
}
}
async getVariantEntries_(variants) {
async getVariantEntries_(variants, config = { publish: false }) {
try {
const contentfulVariants = await Promise.all(
variants.map((variant) =>
this.updateProductVariantInContentful(variant)
)
variants.map(async (variant) => {
let updated = await this.updateProductVariantInContentful(variant)
if (config.publish) {
updated = updated.publish()
}
return updated
})
)
return contentfulVariants
@@ -137,13 +155,21 @@ class ContentfulService extends BaseService {
})
const environment = await this.getContentfulEnvironment_()
const variantEntries = await this.getVariantEntries_(p.variants)
const variantEntries = await this.getVariantEntries_(p.variants, {
publish: true,
})
const variantLinks = this.getVariantLinks_(variantEntries)
const fields = {
[this.getCustomField("title", "product")]: {
"en-US": p.title,
},
[this.getCustomField("subtitle", "product")]: {
"en-US": p.subtitle,
},
[this.getCustomField("description", "product")]: {
"en-US": p.description,
},
[this.getCustomField("variants", "product")]: {
"en-US": variantLinks,
},
@@ -157,7 +183,14 @@ class ContentfulService extends BaseService {
if (p.images.length > 0) {
const imageLinks = await this.createImageAssets(product)
if (imageLinks) {
fields.images = {
"en-US": imageLinks,
}
}
}
if (p.thumbnail) {
const thumbnailAsset = await environment.createAsset({
fields: {
title: {
@@ -176,7 +209,7 @@ class ContentfulService extends BaseService {
},
})
await thumbnailAsset.processForAllLocales()
await thumbnailAsset.processForAllLocales().then((a) => a.publish())
const thumbnailLink = {
sys: {
@@ -189,12 +222,6 @@ class ContentfulService extends BaseService {
fields.thumbnail = {
"en-US": thumbnailLink,
}
if (imageLinks) {
fields.images = {
"en-US": imageLinks,
}
}
}
if (p.type) {
@@ -233,9 +260,6 @@ class ContentfulService extends BaseService {
fields,
})
// const ignoreIds = (await this.getIgnoreIds_("product")) || []
// ignoreIds.push(product.id)
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
return result
} catch (error) {
throw error
@@ -282,12 +306,125 @@ class ContentfulService extends BaseService {
}
}
async createRegionInContentful(region) {
const hasType = await this.getType("region")
.then(() => true)
.catch(() => false)
if (!hasType) {
return
}
try {
const r = await this.regionService_.retrieve(region.id, {
relations: ["countries", "payment_providers", "fulfillment_providers"],
})
const environment = await this.getContentfulEnvironment_()
const fields = {
[this.getCustomField("medusaId", "region")]: {
"en-US": r.id,
},
[this.getCustomField("name", "region")]: {
"en-US": r.name,
},
[this.getCustomField("countries", "region")]: {
"en-US": r.countries,
},
[this.getCustomField("paymentProviders", "region")]: {
"en-US": r.payment_providers,
},
[this.getCustomField("fulfillmentProviders", "region")]: {
"en-US": r.fulfillment_providers,
},
}
const result = await environment.createEntryWithId("region", r.id, {
fields,
})
return result
} catch (error) {
throw error
}
}
async updateRegionInContentful(data) {
const hasType = await this.getType("region")
.then(() => true)
.catch(() => false)
if (!hasType) {
return
}
const updateFields = [
"name",
"currency_code",
"countries",
"payment_providers",
"fulfillment_providers",
]
const found = data.fields.find((f) => updateFields.includes(f))
if (!found) {
return
}
try {
const ignore = await this.shouldIgnore_(data.id, "contentful")
if (ignore) {
return
}
const r = await this.regionService_.retrieve(data.id, {
relations: ["countries", "payment_providers", "fulfillment_providers"],
})
const environment = await this.getContentfulEnvironment_()
// check if region exists
let regionEntry = undefined
try {
regionEntry = await environment.getEntry(data.id)
} catch (error) {
return this.createRegionInContentful(r)
}
const regionEntryFields = {
...regionEntry.fields,
[this.getCustomField("name", "region")]: {
"en-US": r.name,
},
[this.getCustomField("countries", "region")]: {
"en-US": r.countries,
},
[this.getCustomField("paymentProviders", "region")]: {
"en-US": r.payment_providers,
},
[this.getCustomField("fulfillmentProviders", "region")]: {
"en-US": r.fulfillment_providers,
},
}
regionEntry.fields = regionEntryFields
const updatedEntry = await regionEntry.update()
const publishedEntry = await updatedEntry.publish()
await this.addIgnore_(data.id, "medusa")
return publishedEntry
} catch (error) {
throw error
}
}
async updateProductInContentful(data) {
const updateFields = [
"variants",
"options",
"tags",
"title",
"subtitle",
"tags",
"type",
"type_id",
@@ -302,16 +439,10 @@ class ContentfulService extends BaseService {
}
try {
// const ignoreIds = (await this.getIgnoreIds_("product")) || []
// if (ignoreIds.includes(product.id)) {
// const newIgnoreIds = ignoreIds.filter((id) => id !== product.id)
// this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
// return
// } else {
// ignoreIds.push(product.id)
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
// }
const ignore = await this.shouldIgnore_(data.id, "contentful")
if (ignore) {
return
}
const p = await this.productService_.retrieve(data.id, {
relations: [
@@ -341,6 +472,12 @@ class ContentfulService extends BaseService {
[this.getCustomField("title", "product")]: {
"en-US": p.title,
},
[this.getCustomField("subtitle", "product")]: {
"en-US": p.subtitle,
},
[this.getCustomField("description", "product")]: {
"en-US": p.description,
},
[this.getCustomField("options", "product")]: {
"en-US": p.options,
},
@@ -376,7 +513,7 @@ class ContentfulService extends BaseService {
},
})
await thumbnailAsset.processForAllLocales()
await thumbnailAsset.processForAllLocales().then((a) => a.publish())
const thumbnailLink = {
sys: {
@@ -430,6 +567,8 @@ class ContentfulService extends BaseService {
const updatedEntry = await productEntry.update()
const publishedEntry = await updatedEntry.publish()
await this.addIgnore_(data.id, "medusa")
return publishedEntry
} catch (error) {
throw error
@@ -460,19 +599,10 @@ class ContentfulService extends BaseService {
}
try {
// const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
//if (ignoreIds.includes(variant.id)) {
// const newIgnoreIds = ignoreIds.filter((id) => id !== variant.id)
// this.redis_.set(
// "product_variant_ignore_ids",
// JSON.stringify(newIgnoreIds)
// )
// return
//} else {
// ignoreIds.push(variant.id)
// this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
//}
const ignore = await this.shouldIgnore_(variant.id, "contentful")
if (ignore) {
return
}
const environment = await this.getContentfulEnvironment_()
// check if product exists
@@ -512,6 +642,8 @@ class ContentfulService extends BaseService {
const updatedEntry = await variantEntry.update()
const publishedEntry = await updatedEntry.publish()
await this.addIgnore_(variant.id, "medusa")
return publishedEntry
} catch (error) {
throw error
@@ -519,29 +651,42 @@ class ContentfulService extends BaseService {
}
async sendContentfulProductToAdmin(productId) {
const ignore = await this.shouldIgnore_(productId, "medusa")
if (ignore) {
return
}
try {
const environment = await this.getContentfulEnvironment_()
const productEntry = await environment.getEntry(productId)
const product = await this.productService_.retrieve(productId)
//const ignoreIds = (await this.getIgnoreIds_("product")) || []
//if (ignoreIds.includes(productId)) {
// const newIgnoreIds = ignoreIds.filter((id) => id !== productId)
// this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
// return
//} else {
// ignoreIds.push(productId)
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
//}
let update = {}
const title =
productEntry.fields[this.getCustomField("title", "product")]["en-US"]
const subtitle =
productEntry.fields[this.getCustomField("subtitle", "product")]["en-US"]
const description =
productEntry.fields[this.getCustomField("description", "product")][
"en-US"
]
if (product.title !== title) {
update.title = title
}
if (product.subtitle !== subtitle) {
update.subtitle = subtitle
}
if (product.description !== description) {
update.description = description
}
// Get the thumbnail, if present
if (productEntry.fields.thumbnail) {
const thumb = await environment.getAsset(
@@ -556,7 +701,9 @@ class ContentfulService extends BaseService {
}
if (!_.isEmpty(update)) {
await this.productService_.update(productId, update)
await this.productService_.update(productId, update).then(async () => {
return await this.addIgnore_(productId, "contentful")
})
}
} catch (error) {
throw error
@@ -564,32 +711,25 @@ class ContentfulService extends BaseService {
}
async sendContentfulProductVariantToAdmin(variantId) {
const ignore = this.shouldIgnore_(variantId, "medusa")
if (ignore) {
return
}
try {
const environment = await this.getContentfulEnvironment_()
const variantEntry = await environment.getEntry(variantId)
// const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
// if (ignoreIds.includes(variantId)) {
// const newIgnoreIds = ignoreIds.filter((id) => id !== variantId)
// this.redis_.set(
// "product_variant_ignore_ids",
// JSON.stringify(newIgnoreIds)
// )
// return
// } else {
// ignoreIds.push(variantId)
// this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
// }
const updatedVariant = await this.productVariantService_.update(
variantId,
{
const updatedVariant = await this.productVariantService_
.update(variantId, {
title:
variantEntry.fields[this.getCustomField("title", "variant")][
"en-US"
],
}
)
})
.then(async () => {
return await this.addIgnore_(variantId, "contentful")
})
return updatedVariant
} catch (error) {

View File

@@ -10,6 +10,14 @@ class ContentfulSubscriber {
this.contentfulService_ = contentfulService
this.eventBus_ = eventBusService
this.eventBus_.subscribe("region.created", async (data) => {
await this.contentfulService_.createRegionInContentful(data)
})
this.eventBus_.subscribe("region.updated", async (data) => {
await this.contentfulService_.updateRegionInContentful(data)
})
this.eventBus_.subscribe("product-variant.updated", async (data) => {
await this.contentfulService_.updateProductVariantInContentful(data)
})

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.7...medusa-plugin-discount-generator@1.1.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.6...medusa-plugin-discount-generator@1.1.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.5...medusa-plugin-discount-generator@1.1.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.4...medusa-plugin-discount-generator@1.1.5) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.3...medusa-plugin-discount-generator@1.1.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-discount-generator

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-discount-generator",
"version": "1.1.4",
"version": "1.1.8",
"main": "index.js",
"license": "MIT",
"author": "Sebastian Rindom",

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.16...medusa-plugin-economic@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-economic
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.15...medusa-plugin-economic@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-economic
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.14...medusa-plugin-economic@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-economic
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.13...medusa-plugin-economic@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-economic
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.12...medusa-plugin-economic@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-economic

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-economic",
"version": "1.1.13",
"version": "1.1.17",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-economic",
"version": "1.1.13",
"version": "1.1.17",
"description": "E-conomic financial reporting",
"main": "index.js",
"repository": {
@@ -39,8 +39,8 @@
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"moment": "^2.27.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.7...medusa-plugin-ip-lookup@1.1.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.6...medusa-plugin-ip-lookup@1.1.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.5...medusa-plugin-ip-lookup@1.1.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.4...medusa-plugin-ip-lookup@1.1.5) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.3...medusa-plugin-ip-lookup@1.1.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-ip-lookup

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-ip-lookup",
"version": "1.1.4",
"version": "1.1.8",
"description": "IP lookup middleware for Medusa core",
"main": "dist/index.js",
"repository": {

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.16...medusa-plugin-mailchimp@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-mailchimp
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.15...medusa-plugin-mailchimp@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-mailchimp
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.14...medusa-plugin-mailchimp@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-mailchimp
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.13...medusa-plugin-mailchimp@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-mailchimp
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.12...medusa-plugin-mailchimp@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-mailchimp

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-mailchimp",
"version": "1.1.13",
"version": "1.1.17",
"description": "Mailchimp newsletter subscriptions",
"main": "index.js",
"repository": {
@@ -40,8 +40,8 @@
"cors": "^2.8.5",
"express": "^4.17.1",
"mailchimp-api-v3": "^1.14.0",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13"
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.16...medusa-plugin-permissions@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-permissions
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.15...medusa-plugin-permissions@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-permissions
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.14...medusa-plugin-permissions@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-permissions
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.13...medusa-plugin-permissions@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-permissions
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.12...medusa-plugin-permissions@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-permissions

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-permissions",
"version": "1.1.13",
"version": "1.1.17",
"description": "Role permission for Medusa core",
"main": "dist/index.js",
"repository": {
@@ -32,8 +32,8 @@
"medusa-interfaces": "1.x"
},
"dependencies": {
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"mongoose": "^5.8.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.0.9](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.8...medusa-plugin-restock-notification@0.0.9) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.8](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.7](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.6](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.4](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-restock-notification

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-restock-notification",
"version": "0.0.6-next.13+df18c05",
"version": "0.0.9",
"main": "index.js",
"repository": {
"type": "git",
@@ -14,11 +14,11 @@
"@babel/core": "^7.7.5",
"@babel/plugin-transform-typescript": "^7.13.0",
"@babel/preset-typescript": "^7.12.7",
"babel-preset-medusa-package": "^1.1.4",
"babel-preset-medusa-package": "^1.1.8",
"cross-env": "^5.2.1",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-test-utils": "^1.1.13",
"medusa-test-utils": "^1.1.17",
"pg": "^8.5.1",
"ulid": "^2.3.0"
},
@@ -36,7 +36,7 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10"
"medusa-core-utils": "^1.1.14"
},
"gitHead": "df18c053cb9ec801dd3cb54b0a60a4b9ce8e23c4"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.19...medusa-plugin-segment@1.1.20) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.18...medusa-plugin-segment@1.1.19) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.17...medusa-plugin-segment@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.16...medusa-plugin-segment@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.15...medusa-plugin-segment@1.1.16) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-segment

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-segment",
"version": "1.1.16",
"version": "1.1.20",
"description": "Segment Analytics",
"main": "index.js",
"repository": {
@@ -39,8 +39,8 @@
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13"
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.17...medusa-plugin-sendgrid@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-sendgrid
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.16...medusa-plugin-sendgrid@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-sendgrid
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.15...medusa-plugin-sendgrid@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-sendgrid
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.14...medusa-plugin-sendgrid@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-sendgrid
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.13...medusa-plugin-sendgrid@1.1.14) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-sendgrid

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-sendgrid",
"version": "1.1.14",
"version": "1.1.18",
"description": "SendGrid transactional emails",
"main": "index.js",
"repository": {
@@ -39,8 +39,8 @@
"@sendgrid/mail": "^7.1.1",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13"
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.16...medusa-plugin-slack-notification@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-slack-notification
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.15...medusa-plugin-slack-notification@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-slack-notification
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.14...medusa-plugin-slack-notification@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-slack-notification
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.13...medusa-plugin-slack-notification@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-slack-notification
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.12...medusa-plugin-slack-notification@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-slack-notification

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-economic",
"version": "1.1.13",
"version": "1.1.17",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-slack-notification",
"version": "1.1.13",
"version": "1.1.17",
"description": "Slack notifications",
"main": "index.js",
"repository": {
@@ -39,8 +39,8 @@
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"moment": "^2.27.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.16...medusa-plugin-twilio-sms@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-twilio-sms
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.15...medusa-plugin-twilio-sms@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-twilio-sms
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.14...medusa-plugin-twilio-sms@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-twilio-sms
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.13...medusa-plugin-twilio-sms@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-twilio-sms
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.12...medusa-plugin-twilio-sms@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-twilio-sms

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-twilio-sms",
"version": "1.1.13",
"version": "1.1.17",
"main": "index.js",
"repository": {
"type": "git",
@@ -35,8 +35,8 @@
"dependencies": {
"@babel/plugin-transform-classes": "^7.9.5",
"body-parser": "^1.19.0",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"twilio": "^3.49.1"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.16...medusa-plugin-wishlist@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.15...medusa-plugin-wishlist@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.14...medusa-plugin-wishlist@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.13...medusa-plugin-wishlist@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.12...medusa-plugin-wishlist@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-wishlist

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-wishlist",
"version": "1.1.13",
"version": "1.1.17",
"description": "Provides /customers/:id/wishlist to add items to a customr's wishlist",
"main": "index.js",
"repository": {
@@ -37,8 +37,8 @@
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.10",
"medusa-test-utils": "^1.1.13"
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}

View File

@@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.16...medusa-test-utils@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-test-utils
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.15...medusa-test-utils@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-test-utils
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.14...medusa-test-utils@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-test-utils
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.13...medusa-test-utils@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-test-utils
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.12...medusa-test-utils@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-test-utils

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-test-utils",
"version": "1.1.13",
"version": "1.1.17",
"description": "Test utils for Medusa",
"main": "dist/index.js",
"repository": {
@@ -29,7 +29,7 @@
},
"dependencies": {
"@babel/plugin-transform-classes": "^7.9.5",
"medusa-core-utils": "^1.1.10",
"medusa-core-utils": "^1.1.14",
"randomatic": "^3.1.1"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"

View File

@@ -3,6 +3,109 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.26](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.25...@medusajs/medusa@1.1.26) (2021-06-10)
### Bug Fixes
* avoid error message ([0a62590](https://github.com/medusajs/medusa/commit/0a62590044ab01eb81795de69c0f7017372394cc))
## [1.1.25](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.24...@medusajs/medusa@1.1.25) (2021-06-09)
**Note:** Version bump only for package @medusajs/medusa
## [1.1.24](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.23...@medusajs/medusa@1.1.24) (2021-06-09)
### Bug Fixes
* babel ([813a1c9](https://github.com/medusajs/medusa/commit/813a1c95a86139a3293c6f8d8bc13f4eb76ef96e))
* bearer user id login development ([df50186](https://github.com/medusajs/medusa/commit/df5018669ce7b727798234e74cda30de262bbb91))
* common registration name formatter ([f4f67a3](https://github.com/medusajs/medusa/commit/f4f67a376dcb6a4d6734c227ba3c2a9e3353a5ce))
* migration dirs ([57a2de6](https://github.com/medusajs/medusa/commit/57a2de64b209544c39af5a7dae43f1230cf36058))
* migration dirs ([e764d8e](https://github.com/medusajs/medusa/commit/e764d8e465fb2ce1a2330cc55097d15dde647074))
* order order ([245ccdc](https://github.com/medusajs/medusa/commit/245ccdc4774965cdd27d4dbdb5fbb084c8066c66))
* PR ([e20ba1e](https://github.com/medusajs/medusa/commit/e20ba1e4faa8d13b3fc35c7c2fe8597c6ec8f41c))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
* test name registration ([e59dc3b](https://github.com/medusajs/medusa/commit/e59dc3b6c85db369c0b7dd3d097578fc2b527431))
* wip ([42d9a48](https://github.com/medusajs/medusa/commit/42d9a487ff1239f32a00bf47df3218ff3cf03217))
* **medusa:** Add free shipping functionality ([#241](https://github.com/medusajs/medusa/issues/241)) ([fb0613d](https://github.com/medusajs/medusa/commit/fb0613d3cbbfeb858b4a4a0f4da859b9692379bd))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
* allow custom address on claims ([586f4d8](https://github.com/medusajs/medusa/commit/586f4d884c4b7b5b84fbd1f4dbf5c6fb2ffccf50))
* **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.23](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.23...@medusajs/medusa@1.1.23) (2021-06-09)
### Bug Fixes
* babel ([813a1c9](https://github.com/medusajs/medusa/commit/813a1c95a86139a3293c6f8d8bc13f4eb76ef96e))
* bearer user id login development ([df50186](https://github.com/medusajs/medusa/commit/df5018669ce7b727798234e74cda30de262bbb91))
* common registration name formatter ([f4f67a3](https://github.com/medusajs/medusa/commit/f4f67a376dcb6a4d6734c227ba3c2a9e3353a5ce))
* migration dirs ([57a2de6](https://github.com/medusajs/medusa/commit/57a2de64b209544c39af5a7dae43f1230cf36058))
* migration dirs ([e764d8e](https://github.com/medusajs/medusa/commit/e764d8e465fb2ce1a2330cc55097d15dde647074))
* order order ([245ccdc](https://github.com/medusajs/medusa/commit/245ccdc4774965cdd27d4dbdb5fbb084c8066c66))
* PR ([e20ba1e](https://github.com/medusajs/medusa/commit/e20ba1e4faa8d13b3fc35c7c2fe8597c6ec8f41c))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
* test name registration ([e59dc3b](https://github.com/medusajs/medusa/commit/e59dc3b6c85db369c0b7dd3d097578fc2b527431))
* wip ([42d9a48](https://github.com/medusajs/medusa/commit/42d9a487ff1239f32a00bf47df3218ff3cf03217))
* **medusa:** Add free shipping functionality ([#241](https://github.com/medusajs/medusa/issues/241)) ([fb0613d](https://github.com/medusajs/medusa/commit/fb0613d3cbbfeb858b4a4a0f4da859b9692379bd))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
* allow custom address on claims ([586f4d8](https://github.com/medusajs/medusa/commit/586f4d884c4b7b5b84fbd1f4dbf5c6fb2ffccf50))
* **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.22](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.23...@medusajs/medusa@1.1.22) (2021-06-09)
### Bug Fixes
* babel ([813a1c9](https://github.com/medusajs/medusa/commit/813a1c95a86139a3293c6f8d8bc13f4eb76ef96e))
* bearer user id login development ([df50186](https://github.com/medusajs/medusa/commit/df5018669ce7b727798234e74cda30de262bbb91))
* common registration name formatter ([f4f67a3](https://github.com/medusajs/medusa/commit/f4f67a376dcb6a4d6734c227ba3c2a9e3353a5ce))
* migration dirs ([57a2de6](https://github.com/medusajs/medusa/commit/57a2de64b209544c39af5a7dae43f1230cf36058))
* migration dirs ([e764d8e](https://github.com/medusajs/medusa/commit/e764d8e465fb2ce1a2330cc55097d15dde647074))
* order order ([245ccdc](https://github.com/medusajs/medusa/commit/245ccdc4774965cdd27d4dbdb5fbb084c8066c66))
* PR ([e20ba1e](https://github.com/medusajs/medusa/commit/e20ba1e4faa8d13b3fc35c7c2fe8597c6ec8f41c))
* setup to allow login to Medusa Cloud ([bbd2f02](https://github.com/medusajs/medusa/commit/bbd2f02d549330df160c76cf1f4e4d5e7d08f246))
* test name registration ([e59dc3b](https://github.com/medusajs/medusa/commit/e59dc3b6c85db369c0b7dd3d097578fc2b527431))
* wip ([42d9a48](https://github.com/medusajs/medusa/commit/42d9a487ff1239f32a00bf47df3218ff3cf03217))
* **medusa:** Add free shipping functionality ([#241](https://github.com/medusajs/medusa/issues/241)) ([fb0613d](https://github.com/medusajs/medusa/commit/fb0613d3cbbfeb858b4a4a0f4da859b9692379bd))
### Features
* **cli:** adds seed script ([5136c77](https://github.com/medusajs/medusa/commit/5136c7740137afcda52393131ef931eb76ea9f5d))
* allow custom address on claims ([586f4d8](https://github.com/medusajs/medusa/commit/586f4d884c4b7b5b84fbd1f4dbf5c6fb2ffccf50))
* **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.20](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.23...@medusajs/medusa@1.1.20) (2021-06-08)

View File

@@ -1,6 +1,6 @@
{
"name": "@medusajs/medusa",
"version": "1.1.22-next.12+245ccdc",
"version": "1.1.26",
"description": "E-commerce for JAMstack",
"main": "dist/index.js",
"repository": {
@@ -17,11 +17,11 @@
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/preset-typescript": "^7.13.0",
"babel-preset-medusa-package": "^1.1.5-next.0",
"babel-preset-medusa-package": "^1.1.8",
"cross-env": "^5.2.1",
"eslint": "^6.8.0",
"jest": "^25.5.2",
"medusa-interfaces": "^1.1.12-next.0",
"medusa-interfaces": "^1.1.15",
"nodemon": "^2.0.1",
"prettier": "^1.19.1",
"supertest": "^4.0.2"
@@ -59,8 +59,8 @@
"joi": "^17.3.0",
"joi-objectid": "^3.0.1",
"jsonwebtoken": "^8.5.1",
"medusa-core-utils": "^1.1.11-next.0",
"medusa-test-utils": "^1.1.14-next.0",
"medusa-core-utils": "^1.1.14",
"medusa-test-utils": "^1.1.17",
"morgan": "^1.9.1",
"multer": "^1.4.2",
"passport": "^0.4.0",
@@ -79,4 +79,4 @@
"winston": "^3.2.1"
},
"gitHead": "245ccdc4774965cdd27d4dbdb5fbb084c8066c66"
}
}

View File

@@ -1,4 +1,8 @@
import { MedusaError, Validator } from "medusa-core-utils"
import {
MedusaError,
Validator,
transformIdableFields,
} from "medusa-core-utils"
import { defaultFields, defaultRelations } from "."
/**
@@ -137,11 +141,13 @@ export default async (req, res) => {
metadata: Validator.object().optional(),
})
const { value, error } = schema.validate(req.body)
let { value, error } = schema.validate(req.body)
if (error) {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
value = transformIdableFields(value, ["shipping_address", "billing_address"])
try {
const draftOrderService = req.scope.resolve("draftOrderService")
let draftOrder = await draftOrderService.create(value)

View File

@@ -10,10 +10,10 @@ describe("POST /store/carts/:id/payment-session/update", () => {
const cartId = IdMap.getId("cartWithPaySessions")
subject = await request(
"POST",
`/store/carts/${cartId}/payment-session/update`,
`/store/carts/${cartId}/payment-sessions/default_provider`,
{
payload: {
session: {
data: {
data: "Something",
},
},
@@ -26,6 +26,12 @@ describe("POST /store/carts/:id/payment-session/update", () => {
})
it("calls CartService updatePaymentSession", () => {
expect(CartServiceMock.setPaymentSession).toHaveBeenCalledTimes(1)
expect(CartServiceMock.setPaymentSession).toHaveBeenCalledWith(
IdMap.getId("cartWithPaySessions"),
"default_provider"
)
expect(CartServiceMock.updatePaymentSession).toHaveBeenCalledTimes(1)
expect(CartServiceMock.updatePaymentSession).toHaveBeenCalledWith(
IdMap.getId("cartWithPaySessions"),

View File

@@ -1,7 +1,7 @@
import { MedusaError } from "medusa-core-utils"
/**
* @oas [post] /carts/{id}/complete-cart
* @oas [post] /carts/{id}/complete
* summary: "Complete a Cart"
* operationId: "PostCartsCartComplete"
* description: "Completes a cart. The following steps will be performed. Payment

View File

@@ -24,6 +24,12 @@ export default (app, container) => {
route.post("/:id", middlewares.wrap(require("./update-cart").default))
route.post(
"/:id/complete",
middlewares.wrap(require("./complete-cart").default)
)
// DEPRECATION
route.post(
"/:id/complete-cart",
middlewares.wrap(require("./complete-cart").default)
@@ -55,7 +61,7 @@ export default (app, container) => {
)
route.post(
"/:id/payment-session/update",
"/:id/payment-sessions/:provider_id",
middlewares.wrap(require("./update-payment-session").default)
)

View File

@@ -2,12 +2,13 @@ import { Validator, MedusaError } from "medusa-core-utils"
import { defaultFields, defaultRelations } from "./"
/**
* @oas [post] /carts/{id}/payment-session/update
* @oas [post] /carts/{id}/payment-sessions/{provider_id}
* operationId: PostCartsCartPaymentSessionUpdate
* summary: Update a Payment Session
* description: "Updates a Payment Session with additional data."
* parameters:
* - (path) id=* {string} The id of the Cart.
* - (path) provider_id=* {string} The id of the payment provider.
* - (body) provider_id=* {string} The id of the Payment Provider responsible for the Payment Session to update.
* - (body) data=* {object} The data to update the payment session with.
* tags:
@@ -23,10 +24,10 @@ import { defaultFields, defaultRelations } from "./"
* $ref: "#/components/schemas/cart"
*/
export default async (req, res) => {
const { id } = req.params
const { id, provider_id } = req.params
const schema = Validator.object().keys({
session: Validator.object().required(),
data: Validator.object().required(),
})
const { value, error } = schema.validate(req.body)
@@ -37,7 +38,8 @@ export default async (req, res) => {
try {
const cartService = req.scope.resolve("cartService")
await cartService.updatePaymentSession(id, value.session)
await cartService.setPaymentSession(id, provider_id)
await cartService.updatePaymentSession(id, value.data)
const cart = await cartService.retrieve(id, {
select: defaultFields,

View File

@@ -0,0 +1,31 @@
import { MigrationInterface, QueryRunner } from "typeorm"
export class gcRemoveUniqueOrder1624287602631 implements MigrationInterface {
name = "gcRemoveUniqueOrder1624287602631"
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "gift_card" DROP CONSTRAINT "FK_dfc1f02bb0552e79076aa58dbb0"`
)
await queryRunner.query(`COMMENT ON COLUMN "gift_card"."order_id" IS NULL`)
await queryRunner.query(
`ALTER TABLE "gift_card" DROP CONSTRAINT "REL_dfc1f02bb0552e79076aa58dbb"`
)
await queryRunner.query(
`ALTER TABLE "gift_card" ADD CONSTRAINT "FK_dfc1f02bb0552e79076aa58dbb0" FOREIGN KEY ("order_id") REFERENCES "order"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "gift_card" DROP CONSTRAINT "FK_dfc1f02bb0552e79076aa58dbb0"`
)
await queryRunner.query(
`ALTER TABLE "gift_card" ADD CONSTRAINT "REL_dfc1f02bb0552e79076aa58dbb" UNIQUE ("order_id")`
)
await queryRunner.query(`COMMENT ON COLUMN "gift_card"."order_id" IS NULL`)
await queryRunner.query(
`ALTER TABLE "gift_card" ADD CONSTRAINT "FK_dfc1f02bb0552e79076aa58dbb0" FOREIGN KEY ("order_id") REFERENCES "order"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
)
}
}

View File

@@ -8,7 +8,6 @@ import {
Column,
PrimaryColumn,
ManyToOne,
OneToOne,
JoinColumn,
} from "typeorm"
import { ulid } from "ulid"
@@ -43,7 +42,7 @@ export class GiftCard {
@Column({ nullable: true })
order_id: string
@OneToOne(() => Order)
@ManyToOne(() => Order)
@JoinColumn({ name: "order_id" })
order: Order

View File

@@ -323,6 +323,9 @@ export const CartServiceMock = {
applyDiscount: jest.fn().mockImplementation((cartId, code) => {
return Promise.resolve()
}),
setPaymentSession: jest.fn().mockImplementation(cartId => {
return Promise.resolve()
}),
setPaymentSessions: jest.fn().mockImplementation(cartId => {
return Promise.resolve()
}),

View File

@@ -1,6 +1,14 @@
import { IdMap, MockManager, MockRepository } from "medusa-test-utils"
import RegionService from "../region"
const eventBusService = {
emit: jest.fn(),
withTransaction: function() {
return this
},
}
describe("RegionService", () => {
describe("create", () => {
const regionRepository = MockRepository({})
@@ -58,6 +66,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
fulfillmentProviderRepository: fpRepository,
paymentProviderRepository: ppRepository,
currencyRepository,
@@ -168,6 +177,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
})
@@ -237,6 +247,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
fulfillmentProviderRepository: fpRepository,
paymentProviderRepository: ppRepository,
regionRepository,
@@ -335,6 +346,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
fulfillmentProviderRepository: fpRepository,
paymentProviderRepository: ppRepository,
regionRepository,
@@ -380,6 +392,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
})
@@ -429,6 +442,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
countryRepository,
})
@@ -473,6 +487,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
})
@@ -522,6 +537,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
fulfillmentProviderRepository: fpRepository,
paymentProviderRepository: ppRepository,
regionRepository,
@@ -582,6 +598,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
fulfillmentProviderRepository: fpRepository,
regionRepository,
})
@@ -631,6 +648,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
})
@@ -665,6 +683,7 @@ describe("RegionService", () => {
const regionService = new RegionService({
manager: MockManager,
eventBusService,
regionRepository,
})

View File

@@ -306,8 +306,8 @@ class CartService extends BaseService {
const regCountries = region.countries.map(({ iso_2 }) => iso_2)
if (data.shipping_address && typeof data.shipping_address === `string`) {
const addr = await addressRepo.findOne(data.shipping_address)
if (data.shipping_address_id) {
const addr = await addressRepo.findOne(data.shipping_address_id)
data.shipping_address = addr
}
@@ -650,16 +650,14 @@ class CartService extends BaseService {
}
const addrRepo = manager.getCustomRepository(this.addressRepository_)
if ("shipping_address" in update) {
await this.updateShippingAddress_(
cart,
update.shipping_address,
addrRepo
)
if ("shipping_address_id" in update || "shipping_address" in update) {
const address = update.shipping_address_id || update.shipping_address
await this.updateShippingAddress_(cart, address, addrRepo)
}
if ("billing_address" in update) {
await this.updateBillingAddress_(cart, update.billing_address, addrRepo)
if ("billing_address_id" in update || "billing_address" in update) {
const address = update.billing_address_id || update.billing_address
await this.updateBillingAddress_(cart, address, addrRepo)
}
if ("discounts" in update) {

View File

@@ -470,9 +470,9 @@ class OrderService extends BaseService {
)
}
const paymentStatus = await this.paymentProviderService_.getStatus(
payment
)
const paymentStatus = await this.paymentProviderService_
.withTransaction(manager)
.getStatus(payment)
// If payment status is not authorized, we throw
if (paymentStatus !== "authorized" && paymentStatus !== "succeeded") {

View File

@@ -8,11 +8,17 @@ import { countries } from "../utils/countries"
* @implements BaseService
*/
class RegionService extends BaseService {
static Events = {
UPDATED: "region.updated",
CREATED: "region.created",
}
constructor({
manager,
regionRepository,
countryRepository,
storeService,
eventBusService,
currencyRepository,
paymentProviderRepository,
fulfillmentProviderRepository,
@@ -33,6 +39,9 @@ class RegionService extends BaseService {
/** @private @const {StoreService} */
this.storeService_ = storeService
/** @private @const {EventBus} */
this.eventBus_ = eventBusService
/** @private @const {CurrencyRepository} */
this.currencyRepository_ = currencyRepository
@@ -60,6 +69,7 @@ class RegionService extends BaseService {
currencyRepository: this.currencyRepository_,
countryRepository: this.countryRepository_,
storeService: this.storeService_,
eventBusService: this.eventBus_,
paymentProviderRepository: this.paymentProviderRepository_,
paymentProviderService: this.paymentProviderService_,
fulfillmentProviderRepository: this.fulfillmentProviderRepository_,
@@ -117,6 +127,13 @@ class RegionService extends BaseService {
const created = regionRepository.create(regionObject)
const result = await regionRepository.save(created)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.CREATED, {
id: result.id,
})
return result
})
}
@@ -168,6 +185,14 @@ class RegionService extends BaseService {
}
const result = await regionRepository.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: result.id,
fields: Object.keys(update),
})
return result
})
}
@@ -390,6 +415,14 @@ class RegionService extends BaseService {
region.countries = [...(region.countries || []), country]
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["countries"],
})
return updated
})
}
@@ -419,6 +452,12 @@ class RegionService extends BaseService {
)
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["countries"],
})
return updated
})
}
@@ -458,6 +497,14 @@ class RegionService extends BaseService {
region.payment_providers = [...region.payment_providers, pp]
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["payment_providers"],
})
return updated
})
}
@@ -497,6 +544,12 @@ class RegionService extends BaseService {
region.fulfillment_providers = [...region.fulfillment_providers, fp]
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["fulfillment_providers"],
})
return updated
})
}
@@ -525,6 +578,12 @@ class RegionService extends BaseService {
)
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["payment_providers"],
})
return updated
})
}
@@ -553,23 +612,15 @@ class RegionService extends BaseService {
)
const updated = await regionRepo.save(region)
await this.eventBus_
.withTransaction(manager)
.emit(RegionService.Events.UPDATED, {
id: updated.id,
fields: ["fulfillment_providers"],
})
return updated
})
}
/**
* Decorates a region
* @param {object} region - the region to decorate
* @param {[string]} fields - the fields to include
* @param {[string]} expandFields - the fields to expand
* @return {Region} the region
*/
async decorate(region, fields, expandFields = []) {
const requiredFields = ["id", "metadata"]
const decorated = _.pick(region, fields.concat(requiredFields))
const final = await this.runDecorators_(decorated)
return final
}
}
export default RegionService

View File

@@ -63,10 +63,9 @@ class OrderSubscriber {
updateDraftOrder = async data => {
const order = await this.orderService_.retrieve(data.id)
const draftOrder = await this.draftOrderService_.retrieveByCartId(
order.cart_id
)
const draftOrder = await this.draftOrderService_
.retrieveByCartId(order.cart_id)
.catch(_ => null)
if (draftOrder) {
await this.draftOrderService_.registerCartCompletion(