Merge branch 'master' into fix/discount-usage

This commit is contained in:
olivermrbl
2021-04-07 12:22:09 +02:00
56 changed files with 772 additions and 160 deletions

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.3...medusa-core-utils@1.1.4) (2021-03-30)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.2...medusa-core-utils@1.1.3) (2021-03-17)
**Note:** Version bump only for package medusa-core-utils

View File

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

View File

@@ -0,0 +1,13 @@
import zeroDecimalCurrencies from "./zero-decimal-currencies"
const humanizeAmount = (amount, currency) => {
let divisor = 100
if (zeroDecimalCurrencies.includes(currency.toLowerCase())) {
divisor = 1
}
return amount / divisor
}
export default humanizeAmount

View File

@@ -5,3 +5,5 @@ export { default as MedusaError } from "./errors"
export { default as getConfigFile } from "./get-config-file"
export { default as createRequireFromPath } from "./create-require-from-path"
export { default as compareObjectsByProp } from "./compare-objects"
export { default as zeroDecimalCurrencies } from "./zero-decimal-currencies"
export { default as humanizeAmount } from "./humanize-amount"

View File

@@ -0,0 +1,20 @@
const zeroDecimalCurrencies = [
"bif",
"clp",
"djf",
"gnf",
"jpy",
"kmf",
"krw",
"mga",
"pyg",
"rwf",
"ugx",
"vnd",
"vuv",
"xaf",
"xof",
"xpf",
]
export default zeroDecimalCurrencies

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.6...medusa-file-spaces@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.5...medusa-file-spaces@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-file-spaces

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-file-spaces",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"stripe": "^8.50.0"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.3...medusa-fulfillment-manual@1.1.4) (2021-03-30)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.2...medusa-fulfillment-manual@1.1.3) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-manual

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-fulfillment-manual",
"version": "1.1.3",
"version": "1.1.4",
"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.3"
"medusa-core-utils": "^1.1.4"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.6...medusa-fulfillment-webshipper@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.5...medusa-fulfillment-webshipper@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-webshipper

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-fulfillment-webshipper",
"version": "1.1.6",
"version": "1.1.7",
"description": "Webshipper Fulfillment provider for Medusa",
"main": "index.js",
"repository": {
@@ -36,7 +36,7 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.3"
"medusa-core-utils": "^1.1.4"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.4...medusa-interfaces@1.1.5) (2021-03-30)
**Note:** Version bump only for package medusa-interfaces
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.3...medusa-interfaces@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-interfaces

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-interfaces",
"version": "1.1.4",
"version": "1.1.5",
"description": "Core interfaces for Medusa",
"main": "dist/index.js",
"repository": {
@@ -35,7 +35,7 @@
"typeorm": "0.x"
},
"dependencies": {
"medusa-core-utils": "^1.1.3"
"medusa-core-utils": "^1.1.4"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.6...medusa-payment-adyen@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.5...medusa-payment-adyen@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-adyen

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-adyen",
"version": "1.1.6",
"version": "1.1.7",
"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.6"
"medusa-test-utils": "^1.1.7"
},
"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.3"
"medusa-core-utils": "^1.1.4"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,17 @@
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-payment-klarna@1.1.8...medusa-payment-klarna@1.1.8) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.7...medusa-payment-klarna@1.1.8) (2021-03-23)

View File

@@ -40,8 +40,8 @@
"axios": "^0.21.0",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.3",
"medusa-test-utils": "^1.1.6"
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
"gitHead": "d78a7ce85876e0bfd9a4bfebe4f5743921961e9c"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.7](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.6...medusa-payment-paypal@1.0.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.6](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.5...medusa-payment-paypal@1.0.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-paypal

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-paypal",
"version": "1.0.6",
"version": "1.0.7",
"description": "Paypal 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.6"
"medusa-test-utils": "^1.1.7"
},
"scripts": {
"build": "babel src -d . --ignore **/__tests__",
@@ -41,7 +41,7 @@
"@paypal/checkout-server-sdk": "^1.0.2",
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.3"
"medusa-core-utils": "^1.1.4"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.6...medusa-payment-stripe@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.5...medusa-payment-stripe@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-stripe

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-payment-stripe",
"version": "1.1.6",
"version": "1.1.7",
"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.6"
"medusa-test-utils": "^1.1.7"
},
"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.3",
"medusa-core-utils": "^1.1.4",
"stripe": "^8.50.0"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.6...medusa-plugin-add-ons@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.5...medusa-plugin-add-ons@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-add-ons

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-add-ons",
"version": "1.1.6",
"version": "1.1.7",
"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.6"
"medusa-test-utils": "^1.1.7"
},
"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.3",
"medusa-core-utils": "^1.1.4",
"redis": "^3.0.2"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.9...medusa-plugin-brightpearl@1.1.10) (2021-04-01)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.9...medusa-plugin-brightpearl@1.1.9) (2021-03-30)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.8...medusa-plugin-brightpearl@1.1.9) (2021-03-25)
**Note:** Version bump only for package medusa-plugin-brightpearl

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-brightpearl",
"version": "1.1.9",
"version": "1.1.10",
"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.6",
"medusa-test-utils": "^1.1.7",
"prettier": "^2.0.5"
},
"scripts": {
@@ -43,8 +43,8 @@
"axios": "^0.19.2",
"axios-rate-limit": "^1.2.1",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.3",
"medusa-core-utils": "^1.1.4",
"randomatic": "^3.1.1"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
"gitHead": "d78a7ce85876e0bfd9a4bfebe4f5743921961e9c"
}

View File

@@ -1,4 +1,4 @@
import { MedusaError } from "medusa-core-utils"
import { MedusaError, humanizeAmount } from "medusa-core-utils"
import { BaseService } from "medusa-interfaces"
import Brightpearl from "../utils/brightpearl"
@@ -299,10 +299,12 @@ class BrightpearlService extends BaseService {
taxCode: region.tax_code,
net: this.bpnum_(
fromRefund.amount,
fromOrder.currency_code,
10000 / (100 + fromOrder.tax_rate)
),
tax: this.bpnum_(
fromRefund.amount * (1 - 100 / (100 + fromOrder.tax_rate))
fromRefund.amount * (1 - 100 / (100 + fromOrder.tax_rate)),
fromOrder.currency_code
),
nominalCode: accountingCode,
},
@@ -320,7 +322,7 @@ class BrightpearlService extends BaseService {
paymentMethodCode: this.options.payment_method_code || "1220",
orderId: creditId,
currencyIsoCode: fromOrder.currency_code.toUpperCase(),
amountPaid: this.bpnum_(fromRefund.amount),
amountPaid: this.bpnum_(fromRefund.amount, fromOrder.currency_code),
paymentDate: new Date(),
paymentType,
}
@@ -389,8 +391,15 @@ class BrightpearlService extends BaseService {
name: "Difference",
quantity: 1,
taxCode: region.tax_code,
net: this.bpnum_(difference, 10000 / (100 + fromOrder.tax_rate)),
tax: this.bpnum_(difference * (1 - 100 / (100 + fromOrder.tax_rate))),
net: this.bpnum_(
difference,
fromOrder.currency_code,
10000 / (100 + fromOrder.tax_rate)
),
tax: this.bpnum_(
difference * (1 - 100 / (100 + fromOrder.tax_rate)),
fromOrder.currency_code
),
nominalCode: this.options.sales_account_code || "4000",
})
}
@@ -406,7 +415,10 @@ class BrightpearlService extends BaseService {
paymentMethodCode: this.options.payment_method_code || "1220",
orderId: creditId,
currencyIsoCode: fromOrder.currency_code.toUpperCase(),
amountPaid: this.bpnum_(fromReturn.refund_amount),
amountPaid: this.bpnum_(
fromReturn.refund_amount,
fromOrder.currencyCode
),
paymentDate: new Date(),
paymentType,
}
@@ -649,10 +661,12 @@ class BrightpearlService extends BaseService {
name: `#${fromOrder.display_id}: Claim ${fromClaim.id}`,
net: this.bpnum_(
fromClaim.refund_amount,
fromOrder.currency_code,
10000 / (100 + fromOrder.tax_rate)
),
tax: this.bpnum_(
fromClaim.refund_amount * (1 - 100 / (100 + fromOrder.tax_rate))
fromClaim.refund_amount * (1 - 100 / (100 + fromOrder.tax_rate)),
fromOrder.currency_code
),
taxCode: region.tax_code,
nominalCode: this.options.sales_account_code || `4000`,
@@ -672,7 +686,10 @@ class BrightpearlService extends BaseService {
paymentMethodCode: this.options.payment_method_code || "1220",
orderId: creditId,
currencyIsoCode: fromOrder.currency_code.toUpperCase(),
amountPaid: this.bpnum_(fromClaim.refund_amount),
amountPaid: this.bpnum_(
fromClaim.refund_amount,
fromOrder.currency_code
),
paymentDate: new Date(),
paymentType,
}
@@ -784,7 +801,7 @@ class BrightpearlService extends BaseService {
orderId: soId,
paymentDate: new Date(),
currencyIsoCode: fromOrder.currency_code.toUpperCase(),
amountPaid: this.bpnum_(fromOrder.total),
amountPaid: this.bpnum_(fromOrder.total, fromOrder.currency_code),
paymentType,
}
@@ -820,9 +837,13 @@ class BrightpearlService extends BaseService {
}
if (config.include_price) {
row.net = this.bpnum_(item.unit_price * item.quantity - ld.amount)
row.net = this.bpnum_(
item.unit_price * item.quantity - ld.amount,
fromOrder.currency_code
)
row.tax = this.bpnum_(
item.unit_price * item.quantity - ld.amount,
fromOrder.currency_code,
fromOrder.tax_rate
)
} else if (config.is_claim) {
@@ -830,7 +851,11 @@ class BrightpearlService extends BaseService {
bpProduct.productId,
this.options.cost_price_list || `1`
)
row.tax = this.bpnum_(row.net * 100, fromOrder.tax_rate)
row.tax = this.bpnum_(
row.net * 100,
fromOrder.currency_code,
fromOrder.tax_rate
)
}
row.quantity = item.quantity
@@ -856,8 +881,12 @@ class BrightpearlService extends BaseService {
if (gcTotal) {
lines.push({
name: `Gift Card`,
net: this.bpnum_(-1 * gcTotal),
tax: this.bpnum_(-1 * gcTotal, fromOrder.tax_rate),
net: this.bpnum_(-1 * gcTotal, fromOrder.currency_code),
tax: this.bpnum_(
-1 * gcTotal,
fromOrder.currency_code,
fromOrder.tax_rate
),
quantity: 1,
taxCode: region.tax_code,
nominalCode: this.options.gift_card_account_code || "4000",
@@ -872,8 +901,12 @@ class BrightpearlService extends BaseService {
lines.push({
name: `Shipping: ${shippingMethods.map((m) => m.name).join(" + ")}`,
quantity: 1,
net: this.bpnum_(shippingTotal),
tax: this.bpnum_(shippingTotal, fromOrder.tax_rate),
net: this.bpnum_(shippingTotal, fromOrder.currency_code),
tax: this.bpnum_(
shippingTotal,
fromOrder.currency_code,
fromOrder.tax_rate
),
taxCode: region.tax_code,
nominalCode: this.options.shipping_account_code || "4040",
})
@@ -1112,8 +1145,8 @@ class BrightpearlService extends BaseService {
)
}
bpnum_(number, taxRate = 100) {
const bpNumber = number / 100
bpnum_(number, currency, taxRate = 100) {
const bpNumber = humanizeAmount(number, currency)
return this.bpround_(bpNumber * (taxRate / 100))
}
}

View File

@@ -3,6 +3,28 @@
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-contentful@1.1.8...medusa-plugin-contentful@1.1.8) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.7...medusa-plugin-contentful@1.1.8) (2021-03-26)
### Bug Fixes
* update all contentful ([806918a](https://github.com/medusajs/medusa/commit/806918a10e42fde60240dcc785d8e175dc8507b5))
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.6...medusa-plugin-contentful@1.1.7) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-contentful

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-contentful",
"version": "1.1.7",
"version": "1.1.8",
"description": "Contentful plugin for Medusa Commerce",
"main": "index.js",
"repository": {
@@ -39,9 +39,9 @@
"body-parser": "^1.19.0",
"contentful-management": "^5.27.1",
"express": "^4.17.1",
"medusa-core-utils": "^1.1.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"redis": "^3.0.2"
},
"gitHead": "739b7b3cc5ff31aa7a15637db2000e645c7597b1"
"gitHead": "d78a7ce85876e0bfd9a4bfebe4f5743921961e9c"
}

View File

@@ -449,9 +449,14 @@ class ContentfulService extends BaseService {
"options",
]
const found = variant.fields.find((f) => updateFields.includes(f))
if (!found) {
return
// Update came directly from product variant service so only act on a couple
// of fields. When the update comes from the product we want to ensure
// references are set up correctly so we run through everything.
if (variant.fields) {
const found = variant.fields.find((f) => updateFields.includes(f))
if (!found) {
return
}
}
try {

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.6...medusa-plugin-economic@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-economic
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.5...medusa-plugin-economic@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-economic

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-economic",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"moment": "^2.27.0"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.6...medusa-plugin-mailchimp@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-mailchimp
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.5...medusa-plugin-mailchimp@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-mailchimp

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-mailchimp",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6"
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.6...medusa-plugin-permissions@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-permissions
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.5...medusa-plugin-permissions@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-permissions

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-permissions",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"mongoose": "^5.8.0"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.9...medusa-plugin-segment@1.1.10) (2021-04-02)
### Bug Fixes
* adds exchange rates api key ([8eec38a](https://github.com/medusajs/medusa/commit/8eec38af7164fe60106b8dac33ae9acfeb2b0f2e))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.8...medusa-plugin-segment@1.1.9) (2021-03-30)
### Bug Fixes
* adds tests for segment ([1b00f96](https://github.com/medusajs/medusa/commit/1b00f967dea3dc3aa65fafbe1334492fba5c33c2))
* don't divide zero decimal currencies ([3258955](https://github.com/medusajs/medusa/commit/3258955b462f91fc6f4d807c5cc9b5ad11d6bbdf))
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.7...medusa-plugin-segment@1.1.8) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-segment

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-segment",
"version": "1.1.8",
"version": "1.1.10",
"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.3",
"medusa-test-utils": "^1.1.6"
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7"
},
"gitHead": "0c294b7b3acbc1b873aab7e90a8e596bdac48899"
}

View File

@@ -0,0 +1,188 @@
import SegmentService from "../segment"
jest.mock("analytics-node")
const orderFactory = (config = {}) => {
return {
id: "12355",
display_id: "1234",
cart_id: "cart_13",
region_id: "reg_123",
items: [
{
title: "Test",
variant: {
product_id: "prod_123",
sku: "TEST",
},
unit_price: 1100,
quantity: 2,
},
],
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
payments: [
{
id: "123",
},
],
tax_rate: 23.1,
currency_code: "DKK",
discounts: [],
shipping_address: {
first_name: "Test",
last_name: "Testson",
address_1: "Test",
address_2: "TEst",
postal_code: "1234",
country_code: "DK",
phone: "12345678",
},
email: "test@example.com",
subtotal: 2200,
total: 12399,
tax_total: 0,
shipping_total: 12399,
discount_total: 0,
gift_card_total: 0,
...config,
}
}
describe("SegmentService", () => {
const ProductService = {
retrieve: () =>
Promise.resolve({
collection: { title: "Collection" },
type: { value: "Type" },
subtitle: "Subtitle",
}),
}
const TotalsService = {
getLineItemRefund: (_, item) => {
return item.unit_price
},
}
describe("buildOrder", () => {
const segmentService = new SegmentService(
{
productService: ProductService,
totalsService: TotalsService,
},
{ account: "test" }
)
segmentService.getReportingValue = async (_, v) => {
const num = v
return Promise.resolve(Number(Math.round(num + "e2") + "e-2"))
}
it("successfully builds sales order", async () => {
jest.clearAllMocks()
const order = orderFactory()
const segmentOrder = await segmentService.buildOrder(order)
expect(segmentOrder).toEqual({
checkout_id: "cart_13",
coupon: undefined,
currency: "DKK",
discount: 0,
email: "test@example.com",
order_id: "12355",
payment_provider: "",
products: [
{
category: "Collection",
name: "Test",
price: 4.47,
product_id: "prod_123",
quantity: 2,
reporting_revenue: 8.94,
sku: "",
subtitle: "Subtitle",
type: "Type",
variant: "TEST",
},
],
region_id: "reg_123",
reporting_discount: 0,
reporting_revenue: 123.99,
reporting_shipping: 123.99,
reporting_subtotal: 22,
reporting_tax: 0,
reporting_total: 123.99,
revenue: 123.99,
shipping: 123.99,
shipping_city: undefined,
shipping_country: "DK",
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
subtotal: 22,
tax: 0,
total: 123.99,
})
})
it("successfully builds order with zero decimal currency", async () => {
jest.clearAllMocks()
const order = orderFactory({ currency_code: "krw" })
const segmentOrder = await segmentService.buildOrder(order)
expect(segmentOrder).toEqual({
checkout_id: "cart_13",
coupon: undefined,
currency: "KRW",
discount: 0,
email: "test@example.com",
order_id: "12355",
payment_provider: "",
products: [
{
category: "Collection",
name: "Test",
price: 446.79,
product_id: "prod_123",
quantity: 2,
reporting_revenue: 893.58,
sku: "",
subtitle: "Subtitle",
type: "Type",
variant: "TEST",
},
],
region_id: "reg_123",
reporting_discount: 0,
reporting_revenue: 12399,
reporting_shipping: 12399,
reporting_subtotal: 2200,
reporting_tax: 0,
reporting_total: 12399,
revenue: 12399,
shipping: 12399,
shipping_city: undefined,
shipping_country: "DK",
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
subtotal: 2200,
tax: 0,
total: 12399,
})
})
})
})

View File

@@ -1,6 +1,7 @@
import Analytics from "analytics-node"
import axios from "axios"
import { BaseService } from "medusa-interfaces"
import { humanizeAmount } from "medusa-core-utils"
class SegmentService extends BaseService {
/**
@@ -43,26 +44,28 @@ class SegmentService extends BaseService {
"EUR"
if (fromCurrency === toCurrency) {
return this.totalsService_.rounded(value)
return this.rounded_(value)
}
const exchangeRate = await axios
.get(
`https://api.exchangeratesapi.io/${date}?symbols=${fromCurrency}&base=${toCurrency}`
`https://api.exchangeratesapi.io/${date}?symbols=${fromCurrency}&base=${toCurrency}&access_key=${this.options_.exchange_rates_api_key}`
)
.then(({ data }) => {
return data.rates[fromCurrency]
})
return this.totalsService_.rounded(value / exchangeRate)
return this.rounded_(value / exchangeRate)
}
async buildOrder(order) {
const subtotal = order.subtotal / 100
const total = order.total / 100
const tax = order.tax_total / 100
const discount = order.discount_total / 100
const shipping = order.shipping_total / 100
const curr = order.currency_code
const subtotal = humanizeAmount(order.subtotal, curr)
const total = humanizeAmount(order.total, curr)
const tax = humanizeAmount(order.tax_total, curr)
const discount = humanizeAmount(order.discount_total, curr)
const shipping = humanizeAmount(order.shipping_total, curr)
const revenue = total - tax
let coupon
@@ -119,7 +122,7 @@ class SegmentService extends BaseService {
const revenue = await this.getReportingValue(
order.currency_code,
lineTotal / 100
humanizeAmount(lineTotal, curr)
)
let sku = ""
@@ -141,7 +144,9 @@ class SegmentService extends BaseService {
return {
name,
variant,
price: lineTotal / 100 / item.quantity,
price: this.rounded_(
humanizeAmount(lineTotal, curr) / item.quantity
),
reporting_revenue: revenue,
product_id: item.variant.product_id,
category: product.collection?.title,
@@ -156,6 +161,10 @@ class SegmentService extends BaseService {
return orderData
}
rounded_(v) {
return Number(Math.round(v + "e2") + "e-2")
}
}
export default SegmentService

View File

@@ -3,6 +3,18 @@
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-sendgrid@1.1.7...medusa-plugin-sendgrid@1.1.8) (2021-03-30)
### Bug Fixes
* format numbers correctly in sendgrid ([7682980](https://github.com/medusajs/medusa/commit/7682980c58f1a01f0c510b1d4feae3a62892040c))
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.6...medusa-plugin-sendgrid@1.1.7) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-sendgrid

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-sendgrid",
"version": "1.1.7",
"version": "1.1.8",
"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.3",
"medusa-test-utils": "^1.1.6"
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
"gitHead": "d78a7ce85876e0bfd9a4bfebe4f5743921961e9c"
}

View File

@@ -1,6 +1,8 @@
import { NotificationService } from "medusa-interfaces"
import SendGrid from "@sendgrid/mail"
import { NotificationService } from "medusa-interfaces"
import { humanizeAmount, zeroDecimalCurrencies } from "medusa-core-utils"
class SendGridService extends NotificationService {
static identifier = "sendgrid"
@@ -361,18 +363,24 @@ class SendGridService extends NotificationService {
date: order.created_at.toDateString(),
items,
discounts,
subtotal: `${this.humanPrice_(subtotal * (1 + taxRate))} ${currencyCode}`,
gift_card_total: `${this.humanPrice_(
gift_card_total * (1 + taxRate)
subtotal: `${this.humanPrice_(
subtotal * (1 + taxRate),
currencyCode
)} ${currencyCode}`,
tax_total: `${this.humanPrice_(tax_total)} ${currencyCode}`,
gift_card_total: `${this.humanPrice_(
gift_card_total * (1 + taxRate),
currencyCode
)} ${currencyCode}`,
tax_total: `${this.humanPrice_(tax_total, currencyCode)} ${currencyCode}`,
discount_total: `${this.humanPrice_(
discount_total * (1 + taxRate)
discount_total * (1 + taxRate),
currencyCode
)} ${currencyCode}`,
shipping_total: `${this.humanPrice_(
shipping_total * (1 + taxRate)
shipping_total * (1 + taxRate),
currencyCode
)} ${currencyCode}`,
total: `${this.humanPrice_(total)} ${currencyCode}`,
total: `${this.humanPrice_(total, currencyCode)} ${currencyCode}`,
}
}
@@ -450,15 +458,23 @@ class SendGridService extends NotificationService {
has_shipping: !!returnRequest.shipping_method,
email: order.email,
items: this.processItems_(returnItems, taxRate, currencyCode),
subtotal: `${this.humanPrice_(item_subtotal)} ${currencyCode}`,
shipping_total: `${this.humanPrice_(shippingTotal)} ${currencyCode}`,
subtotal: `${this.humanPrice_(
item_subtotal,
currencyCode
)} ${currencyCode}`,
shipping_total: `${this.humanPrice_(
shippingTotal,
currencyCode
)} ${currencyCode}`,
refund_amount: `${this.humanPrice_(
returnRequest.refund_amount
returnRequest.refund_amount,
currencyCode
)} ${currencyCode}`,
return_request: {
...returnRequest,
refund_amount: `${this.humanPrice_(
returnRequest.refund_amount
returnRequest.refund_amount,
currencyCode
)} ${currencyCode}`,
},
order,
@@ -539,9 +555,18 @@ class SendGridService extends NotificationService {
email: order.email,
items: this.processItems_(swap.additional_items, taxRate, currencyCode),
return_items: returnItems,
return_total: `${this.humanPrice_(returnTotal)} ${currencyCode}`,
refund_amount: `${this.humanPrice_(refundAmount)} ${currencyCode}`,
additional_total: `${this.humanPrice_(additionalTotal)} ${currencyCode}`,
return_total: `${this.humanPrice_(
returnTotal,
currencyCode
)} ${currencyCode}`,
refund_amount: `${this.humanPrice_(
refundAmount,
currencyCode
)} ${currencyCode}`,
additional_total: `${this.humanPrice_(
additionalTotal,
currencyCode
)} ${currencyCode}`,
}
}
@@ -602,12 +627,25 @@ class SendGridService extends NotificationService {
date: swap.updated_at.toDateString(),
email: order.email,
tax_amount: `${this.humanPrice_(
swap.difference_due * taxRate
swap.difference_due * taxRate,
currencyCode
)} ${currencyCode}`,
paid_total: `${this.humanPrice_(
swap.difference_due,
currencyCode
)} ${currencyCode}`,
return_total: `${this.humanPrice_(
returnTotal,
currencyCode
)} ${currencyCode}`,
refund_amount: `${this.humanPrice_(
refundAmount,
currencyCode
)} ${currencyCode}`,
additional_total: `${this.humanPrice_(
additionalTotal,
currencyCode
)} ${currencyCode}`,
paid_total: `${this.humanPrice_(swap.difference_due)} ${currencyCode}`,
return_total: `${this.humanPrice_(returnTotal)} ${currencyCode}`,
refund_amount: `${this.humanPrice_(refundAmount)} ${currencyCode}`,
additional_total: `${this.humanPrice_(additionalTotal)} ${currencyCode}`,
fulfillment: shipment,
tracking_links: shipment.tracking_links,
tracking_number: shipment.tracking_numbers.join(", "),
@@ -647,14 +685,20 @@ class SendGridService extends NotificationService {
...i,
thumbnail: this.normalizeThumbUrl_(i.thumbnail),
price: `${this.humanPrice_(
i.unit_price * (1 + taxRate)
i.unit_price * (1 + taxRate),
currencyCode
)} ${currencyCode}`,
}
})
}
humanPrice_(amount) {
return amount ? (amount / 100).toFixed(2) : "0.00"
humanPrice_(amount, currency) {
if (!amount) {
return "0.00"
}
const normalized = humanizeAmount(amount, currency)
return normalized.toFixed(zeroDecimalCurrencies.includes(currency.toLowerCase()) ? 0 : 2)
}
normalizeThumbUrl_(url) {

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.6...medusa-plugin-slack-notification@1.1.7) (2021-03-30)
### Bug Fixes
* **slack:** show discount code flag ([b5bf650](https://github.com/medusajs/medusa/commit/b5bf650ec26182be6324bc56e7f6efd744a7131e))
* zero decimal amounts in slack + gc total ([c6a5dff](https://github.com/medusajs/medusa/commit/c6a5dffa7bd8f627310d1f90364492084051dd47))
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.5...medusa-plugin-slack-notification@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-slack-notification

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-slack-notification",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"moment": "^2.27.0"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -1,10 +1,13 @@
import axios from "axios"
import { zeroDecimalCurrencies, humanizeAmount } from "medusa-core-utils"
import { BaseService } from "medusa-interfaces"
class SlackService extends BaseService {
/**
* @param {Object} options - options defined in `medusa-config.js`
* {
* show_discount_code: If set to true the discount code used will be
* displayed in the order channel.
* slack_url: "https://hooks.slack.com/services/...",
* admin_orders_url: "https:..../orders"
* }
@@ -58,6 +61,14 @@ class SlackService extends BaseService {
const currencyCode = order.currency_code.toUpperCase()
const taxRate = order.tax_rate / 100
const getDisplayAmount = (amount) => {
const humanAmount = humanizeAmount(amount, currencyCode)
if (zeroDecimalCurrencies.includes(currencyCode.toLowerCase())) {
return humanAmount
}
return humanAmount.toFixed(2)
}
let blocks = [
{
type: "section",
@@ -83,32 +94,46 @@ class SlackService extends BaseService {
type: "section",
text: {
type: "mrkdwn",
text: `*Subtotal*\t${(subtotal / 100).toFixed(
2
)} ${currencyCode}\n*Shipping*\t${(shipping_total / 100).toFixed(
2
)} ${currencyCode}\n*Discount Total*\t${(
discount_total / 100
).toFixed(2)} ${currencyCode}\n*Tax*\t${(tax_total / 100).toFixed(
2
)} ${currencyCode}\n*Total*\t${(total / 100).toFixed(
2
text: `*Subtotal*\t${getDisplayAmount(
subtotal
)} ${currencyCode}\n*Shipping*\t${getDisplayAmount(
shipping_total
)} ${currencyCode}\n*Discount Total*\t${getDisplayAmount(
discount_total
)} ${currencyCode}\n*Tax*\t${getDisplayAmount(
tax_total
)} ${currencyCode}\n*Total*\t${getDisplayAmount(
total
)} ${currencyCode}`,
},
},
]
order.discounts.forEach((d) => {
if (order.gift_card_total) {
blocks.push({
type: "section",
text: {
type: "mrkdwn",
text: `*Promo Code*\t${d.code} ${d.rule.value}${
d.rule.type === "percentage" ? "%" : ` ${currencyCode}`
}`,
text: `*Gift Card Total*\t${getDisplayAmount(
order.gift_card_total
)} ${currencyCode}`,
},
})
})
}
if (this.options_.show_discount_code) {
order.discounts.forEach((d) => {
blocks.push({
type: "section",
text: {
type: "mrkdwn",
text: `*Promo Code*\t${d.code} ${d.rule.value}${
d.rule.type === "percentage" ? "%" : ` ${currencyCode}`
}`,
},
})
})
}
blocks.push({
type: "divider",
@@ -119,19 +144,15 @@ class SlackService extends BaseService {
type: "section",
text: {
type: "mrkdwn",
text: `*${lineItem.title}*\n${lineItem.quantity} x ${(
(lineItem.unit_price / 100) *
(1 + taxRate)
).toFixed(2)} ${currencyCode}`,
text: `*${lineItem.title}*\n${lineItem.quantity} x ${getDisplayAmount(
lineItem.unit_price * (1 + taxRate)
)} ${currencyCode}`,
},
}
if (lineItem.thumbnail) {
let url = lineItem.thumbnail
if (
!lineItem.thumbnail.startsWith("http:") &&
!lineItem.thumbnail.startsWith("https:")
) {
if (lineItem.thumbnail.startsWith("//")) {
url = `https:${lineItem.thumbnail}`
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.6...medusa-plugin-twilio-sms@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-twilio-sms
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.5...medusa-plugin-twilio-sms@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-twilio-sms

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-twilio-sms",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"twilio": "^3.49.1"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.6...medusa-plugin-wishlist@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.5...medusa-plugin-wishlist@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-wishlist

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-wishlist",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-test-utils": "^1.1.6"
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.6...medusa-test-utils@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-test-utils
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.5...medusa-test-utils@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-test-utils

View File

@@ -1,6 +1,6 @@
{
"name": "medusa-test-utils",
"version": "1.1.6",
"version": "1.1.7",
"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.3",
"medusa-core-utils": "^1.1.4",
"randomatic": "^3.1.1"
},
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"

View File

@@ -3,6 +3,47 @@
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/@medusajs/medusa@1.1.16...@medusajs/medusa@1.1.17) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.16](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.16...@medusajs/medusa@1.1.16) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.15](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.16...@medusajs/medusa@1.1.15) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.16](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.15...@medusajs/medusa@1.1.16) (2021-03-26)
**Note:** Version bump only for package @medusajs/medusa
## [1.1.15](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.14...@medusajs/medusa@1.1.15) (2021-03-18)
**Note:** Version bump only for package @medusajs/medusa

View File

@@ -1,6 +1,6 @@
{
"name": "@medusajs/medusa",
"version": "1.1.15",
"version": "1.1.17",
"description": "E-commerce for JAMstack",
"main": "dist/index.js",
"repository": {
@@ -67,8 +67,8 @@
"joi": "^17.3.0",
"joi-objectid": "^3.0.1",
"jsonwebtoken": "^8.5.1",
"medusa-core-utils": "^1.1.3",
"medusa-test-utils": "^1.1.6",
"medusa-core-utils": "^1.1.4",
"medusa-test-utils": "^1.1.7",
"morgan": "^1.9.1",
"multer": "^1.4.2",
"passport": "^0.4.0",
@@ -86,5 +86,5 @@
"uuid": "^8.3.1",
"winston": "^3.2.1"
},
"gitHead": "8c87f25f766154368b0f15424028550966f7d3d6"
"gitHead": "d78a7ce85876e0bfd9a4bfebe4f5743921961e9c"
}

View File

@@ -83,27 +83,35 @@ class ClaimItemService extends BaseService {
)
}
const claimTagRepo = manager.getCustomRepository(this.claimTagRepository_)
const tagsToAdd = await Promise.all(
tags.map(async t => {
const normalized = t.trim().toLowerCase()
const existing = await claimTagRepo.findOne({
where: { value: normalized },
let tagsToAdd = []
if (tags && tags.length) {
const claimTagRepo = manager.getCustomRepository(
this.claimTagRepository_
)
tagsToAdd = await Promise.all(
tags.map(async t => {
const normalized = t.trim().toLowerCase()
const existing = await claimTagRepo.findOne({
where: { value: normalized },
})
if (existing) {
return existing
}
return claimTagRepo.create({ value: normalized })
})
if (existing) {
return existing
}
)
}
return claimTagRepo.create({ value: normalized })
let imagesToAdd = []
if (images && images.length) {
const claimImgRepo = manager.getCustomRepository(
this.claimImageRepository_
)
imagesToAdd = images.map(url => {
return claimImgRepo.create({ url })
})
)
const claimImgRepo = manager.getCustomRepository(
this.claimImageRepository_
)
const imagesToAdd = images.map(url => {
return claimImgRepo.create({ url })
})
}
const created = ciRepo.create({
...rest,