Commit Graph

61 Commits

Author SHA1 Message Date
Oliver Windall Juhl
ba6bb3e54b feat(medusa): Extract cron job logic to its own service (#2821)
**What**
Extract cron job logic from the `EventBusService` to its own service `JobSchedulerService`

**Why**
Preliminary step to extracting the event bus into a module

**Tests**
Tested with a local installation of Medusa

Resolved CORE-918
2022-12-19 19:04:46 +00:00
Sebastian Rindom
61da5f3650 fix(medusa-plugin-brightpearl): account for shipping prices being tax inclusive (#2536)
**What**
BP plugin was recording total shipping price based on the shipping_method.price; however, this value may be with or without taxes depending on the tax inclusivity setting. This change ensures that the shipping price is calculated correctly.
2022-11-03 15:22:49 +00:00
Sebastian Rindom
c56660fca9 feat: new tax api (#979)
* feat: add tax calculation strategy (#885)

* feat: add tax calculation strategy

* fix: adds strategy loader

* fix: eslint ignore

* chore: cleanup

* fix: allow plugin overwrites

* fix: allow plugin overwrites

* fix: fake region

* Update packages/medusa/src/loaders/strategies.ts

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* feat: adds tax related db entities + tax provider (#896)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: pr comments

* fix: unit test

* feat: totals service to ts (#911)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: adds TotalsServiceProps

* feat: adds integration tests for automatic tax calculation + shipping tax rates (#945)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: jsdoc types

* Feat/manual taxes (#950)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: object -> cartOrOrder

* fix: rounding

* Feat/complete order w tax lines (#951)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* fix: adds cart order type gaurds

* Docs/tax api (#954)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* docs: documents tax related methods and types

* fix: require either item_id or shipping_method_id

* feat: product type tax rate (#969)

* feat: adds tax related db entities + tax provider

* fix: add tax provider tests

* fix: add tax service unit tests

* fix: tests + migrations

* feat: totals service to ts

* fix: remove totals.js

* fix: add shipping methods

* fix: add inherited tax lines

* chore: rm tax-line repo

* fix: test

* fix: tests

* fix: tests

* fix: unit test

* fix: integration test helpers

* fix: adds factories + tests automatic tax rates

* fix: remove verbose

* fix: adds TotalsServiceProps

* fix: add shipping tax lines

* fix: add migration for shipping taxes

* fix: integration tests for shipping taxes

* fix: integration tests for shipping taxes

* fix: add integration tests for manual taxes

* fix: cart service - cleanup jsdoc

* feat: add /carts/id/taxes to manually calculate taxes

* feat: add integration tests for order tax calculations

* feat: adds cart completion strategy + create order w. tax lines

* fix: unit tests

* fix: merge

* fix: rm verbose

* fix: unit tests

* fix: unit tests

* fix: unit tests

* fix: ensure calculation for list orders

* fix: unit tests

* fix: integration tests

* docs: documents tax related methods and types

* fix: require either item_id or shipping_method_id

* feat: adds returns tests for new tax system

* feat: adds return lines + integration tests for swaps

* feat: return integration tests

* feat: adds product type tax rates

* feat: add tax management endpoints

* fix: create single migration

* fix: adds tax rates to js client

* fix: strats

* Fix/plugin tests (#998)

* plugin testing setup

* fix: test sendgrid plugin

* fix: test sendgrid plugin

* chore: clean

* chore: clean

* fix: clean up tests

* fix: remove dirty import

* fix: sendgrid + brightpearl

* fix: plugin integration tests

* fix: klarna

* fix: shipping method tax

* fix: remove taxrates

* fix: unit tests

* fix: integration

* fix: integration

* fix: plugins tests

* fix: ignore plugins

* fix: tests

* fix: taxes (#1017)

* fix: taxes

* fix: taxes

* fix: faulty ref

* fix: create tax-lines with claim items

* fix: snapshot tax-liens

* fix: allows integration test teardown to force deleting tables

* fix: tests

* fix: merge

* fix: adds tax-rates to client

* fix: adds tax-rates to medusa-react

* fix: tests

* fix: tests

* fix: add product types

* fix: adds tax provider endpoint + cascaded deletes on tax rate relations

* fix: move errors to service layer

* fix: cleanup api

* fix: unit tests

* fix: error handler in base-service

* fix: Add order region to swap on createFulfillment (#1110)

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-02-24 20:14:09 +01:00
Sebastian Rindom
d8422fc759 fix: add missing discount rule to bp orders (#680) 2021-10-26 22:05:19 +02:00
Sebastian Rindom
bd1e115696 fix: account for non-division currencies in sales credit (#342) 2021-08-30 12:03:46 +02:00
Sebastian Rindom
ef7e52b74b hotfix(medusa-plugin-brightpearl): use new metadata signature (#316)
* hotfix(medusa-plugin-brightpearl): use new metadata signature

* fix: update signature
2021-07-15 11:18:44 +02:00
Sebastian Rindom
a9425abcce Merge remote-tracking branch 'origin/develop' into release/next 2021-06-24 17:57:45 +02:00
Oliver Windall Juhl
c1bec4f843 cleanup: Eventbus, BP, Contentful, NotificationService (#292) 2021-06-24 17:56:02 +02:00
Sebastian Rindom
fd82de6ef9 fix(brightpearl): chunked product availabilities in sync 2021-06-23 17:54:32 +02:00
Sebastian Rindom
9eaf02762f fix: better inventory sync 2021-04-28 11:42:40 +02:00
Oliver Windall Juhl
7343a4e841 release: next (#239)
* hotfix(medusa-plugin-brightpearl): Use order id in sales order endpoint

* feat(medusa-plugin-sendgrid): adds localization option (#238)

* chore(deps): bump y18n from 4.0.0 to 4.0.1 in /packages/medusa-cli (#226)

Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump y18n from 4.0.0 to 4.0.3 in /packages/medusa (#235)

Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.3.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/y18n-v4.0.3/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/compare/v4.0.0...y18n-v4.0.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump y18n from 4.0.0 to 4.0.1 in /e2e/prod-project (#225)

Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump y18n in /packages/medusa-core-utils (#224)

Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(medusa): Swaps on swaps (#229)

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* chore: version bumps

* chore: version bumps

* chore(release): Publish

 - babel-preset-medusa-package@1.1.1
 - @medusajs/medusa-cli@1.1.5
 - medusa-core-utils@1.1.7
 - medusa-dev-cli@0.0.6
 - medusa-file-spaces@1.1.10
 - medusa-fulfillment-manual@1.1.7
 - medusa-fulfillment-webshipper@1.1.10
 - medusa-interfaces@1.1.8
 - medusa-payment-adyen@1.1.10
 - medusa-payment-klarna@1.1.11
 - medusa-payment-paypal@1.0.10
 - medusa-payment-stripe@1.1.10
 - medusa-plugin-add-ons@1.1.10
 - medusa-plugin-brightpearl@1.1.13
 - medusa-plugin-contentful@1.1.11
 - medusa-plugin-discount-generator@1.1.1
 - medusa-plugin-economic@1.1.10
 - medusa-plugin-ip-lookup@1.1.1
 - medusa-plugin-mailchimp@1.1.10
 - medusa-plugin-permissions@1.1.10
 - medusa-plugin-restock-notification@0.0.4
 - medusa-plugin-segment@1.1.13
 - medusa-plugin-sendgrid@1.1.11
 - medusa-plugin-slack-notification@1.1.10
 - medusa-plugin-twilio-sms@1.1.10
 - medusa-plugin-wishlist@1.1.10
 - medusa-test-utils@1.1.10
 - @medusajs/medusa@1.1.20

* chore(release): Publish

 - babel-preset-medusa-package@1.1.2
 - @medusajs/medusa-cli@1.1.6
 - medusa-core-utils@1.1.8
 - medusa-dev-cli@0.0.7
 - medusa-file-spaces@1.1.11
 - medusa-fulfillment-manual@1.1.8
 - medusa-fulfillment-webshipper@1.1.11
 - medusa-interfaces@1.1.9
 - medusa-payment-adyen@1.1.11
 - medusa-payment-klarna@1.1.12
 - medusa-payment-paypal@1.0.11
 - medusa-payment-stripe@1.1.11
 - medusa-plugin-add-ons@1.1.11
 - medusa-plugin-brightpearl@1.1.14
 - medusa-plugin-contentful@1.1.12
 - medusa-plugin-discount-generator@1.1.2
 - medusa-plugin-economic@1.1.11
 - medusa-plugin-ip-lookup@1.1.2
 - medusa-plugin-mailchimp@1.1.11
 - medusa-plugin-permissions@1.1.11
 - medusa-plugin-restock-notification@0.0.5
 - medusa-plugin-segment@1.1.14
 - medusa-plugin-sendgrid@1.1.12
 - medusa-plugin-slack-notification@1.1.11
 - medusa-plugin-twilio-sms@1.1.11
 - medusa-plugin-wishlist@1.1.11
 - medusa-test-utils@1.1.11
 - @medusajs/medusa@1.1.21

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-20 16:40:49 +02:00
Sebastian Rindom
6b51c06c22 Merge pull request #237 from medusajs/hotfix/bp-currency-typo
hotfix(brightpearl): currencyCode -> currency_code
2021-04-16 15:57:54 +02:00
Sebastian Rindom
bed0d5da99 hotfix(brightpearl): currencyCode -> currency_code 2021-04-15 09:53:26 +02:00
Oliver Windall Juhl
345b0e6305 hotfix(medusa-plugin-brightpearl): Use order id in sales order endpoint (#236) 2021-04-14 12:33:09 +02:00
Sebastian Rindom
37ab52b195 fix: typo 2021-04-12 10:07:49 +02:00
Sebastian Rindom
e105d4edde fix: bp swaps 2021-04-12 09:57:35 +02:00
Sebastian Rindom
d78a7ce858 Merge remote-tracking branch 'origin/master' into develop 2021-03-29 09:08:39 +02:00
Sebastian Rindom
a2ef25734e hotfix(bp): only sync from select warehouse 2021-03-25 16:56:08 +01:00
Sebastian Rindom
cfab2d408a fix: don't divide zero decimal currencies 2021-03-22 10:31:22 +01:00
Sebastian Rindom
833da81cc2 hotfix(brightpearl): rounding errors + failing customer test (#199) 2021-03-11 08:23:53 +01:00
Sebastian Rindom
5edcbbd7e1 hotfix(brightpearl): wrap inventory update in transaction (#184) 2021-02-24 09:03:50 +01:00
Sebastian Rindom
d8e806d8ff Hotfix/tag relation (#166)
* fix: remove default tag relation

* fix: auto fulfill bp swaps
2021-02-04 14:38:41 +01:00
Sebastian Rindom
690d339667 feat(medusa,brightpearl,segment,webshipper): claims (#163)
* chore: create tests

* chore: models

* fix: passing initial tests

* test: adds integration test

* test: clean up integration implementation

* fix: claims

* fix: brightpearl + webshipper

* tests: passing

* fix: update claim items

* fix: adds gitignore

* fix: pr comments

* fix: single migration

* fix(medusa-plugin-segment): adds item claimed event to segment
2021-02-03 09:49:12 +01:00
Sebastian Rindom
f1baca3cbd Replaces MongoDB support with PostgreSQL (#151)
- All schemas have been rewritten to a relational model
- All services have been rewritten to accommodate the new data model
- Adds idempotency keys to core endpoints allowing you to retry requests with no additional side effects
- Adds staged jobs to avoid putting jobs in the queue when transactions abort
- Adds atomic transactions to all methods with access to the data layer

Co-authored-by: Oliver Windall Juhl <oliver@mrbltech.com>
2021-01-26 10:26:14 +01:00
Sebastian Rindom
304431e7c3 fix: allow swaps with total < 0 (#143) 2020-12-02 17:37:46 +01:00
Sebastian Rindom
aae8d5e112 fix: swaps with discounts (#142) 2020-11-29 12:18:36 +01:00
Sebastian Rindom
fd04233238 feature: swaps (#137)
* feat: swap schema

* chore(refactor): move returns to separate service

* swap order creates return

* fix: adds returns/fulfillments/shipments and cart creation to swaps

* search products by variants

* feat: swaps ready

* fix: test passing

* chore: include customer expand fields on order

* add tests

* fix: add brightpearl plugin support

* fix: adds swap link template setting

* fix: tests

* fix(medusa-plugin-brightpearl): add swap status option

* docs: add swap description

* fix: adds GET swap in store api

* chore: unmock axios

* fix: passing klarna tests

* fix: pr
2020-11-24 14:02:49 +01:00
Sebastian Rindom
c6996dd530 CircleCI project setup (#138) 2020-11-21 15:50:42 +01:00
Sebastian Rindom
3425c6cbc6 hotfix(medusa-plugin-brightpearl): add email and phone to customer in brightpearl 2020-11-10 10:52:54 +01:00
Sebastian Rindom
f2c62cd232 feat(medusa): adds support for gift cards (#132)
* fix(medusa-plugin-brightpearl): adds gift cards to gift card nominal code

* fix: allow orders with 0 total to be created

* fix: gift card ready

* tests passing

* docs: brightpearl comment

* docs: clearer REMEMBER note
2020-10-28 15:55:50 +01:00
Sebastian Rindom
6979cce59a fix(medusa-plugin-brightpearl): faulty fulfillments 2020-10-08 15:44:57 +02:00
Sebastian Rindom
1f3cbe7bf1 hotfix(medusa-plugin-brightpearl): remove AUTH/CAPTURE
Removes the AUTH/CAPTURE flow; as it creates an issue when a user wants to
delete an authorized order. The order will at that point have a payment and
can thereby not be deleted. By simply using the RECEIPT payment type we avoid
this issue and make it possible to do extended authorization periods.
2020-10-06 18:26:09 +02:00
Sebastian Rindom
0889059ba1 fix(medusa-plugin-brightpearl): reliable oauth (#119) 2020-10-05 11:48:20 +02:00
Sebastian Rindom
34eb53f72e fix(medusa-plugin-brightpearl): automatic token refresh 2020-09-21 18:12:02 +02:00
Sebastian Rindom
cc97908c15 hotfix(plugin-brightpearl): adds missing address parts 2020-09-17 17:59:51 +02:00
Sebastian Rindom
c7bd7838aa fix: cron jobs and brightpearl auto refresh (#107)
* fix: adds automatic refresh of tokens

* fix: send options to plugin loaders

* fix: adds README optional inventory sync
2020-09-10 13:33:38 +02:00
Sebastian Rindom
27052cae27 fix: use correct auth type 2020-09-09 15:24:05 +02:00
Sebastian Rindom
1f6ec9d2f0 fix: send response 2020-09-03 10:31:43 +02:00
Sebastian Rindom
60bbd120ea fix: rounds values when sending to brightpearl 2020-09-03 10:26:35 +02:00
Sebastian Rindom
2609cdcd0d fix: adds endpoint for manual brightpearl uploads 2020-09-03 09:03:23 +02:00
Sebastian Rindom
4006cad45a fix(medusa-plugin-brightpearl): set redirect uri 2020-09-02 10:32:03 +02:00
Sebastian Rindom
bd3c755260 fix: normal string matching available 2020-08-28 13:37:19 +02:00
Sebastian Rindom
df4698ad81 fix(medusa-plugin-brightpearl): id matcihgin 2020-08-28 13:02:41 +02:00
Sebastian Rindom
3093cba610 fix: better rounding of totals 2020-08-28 12:47:53 +02:00
Sebastian Rindom
e25478034b fix(medusa-plugin-brightpearl): more gentle inventory syncs 2020-08-28 11:19:20 +02:00
Sebastian Rindom
902502092f fix(medusa-plugin-brightpearl): allow status updates 2020-08-27 19:10:36 +02:00
Sebastian Rindom
db205bf790 fix(medusa-plugin-brightpearl): only update inventory levels that are out of sync 2020-08-27 09:52:28 +02:00
Sebastian Rindom
a6a35204fe fix(medusa-plugin-brightpearl): ignore goods out created if channel id not medusa 2020-08-26 21:22:17 +02:00
Sebastian Rindom
69dbe9df2f Allow sales account as option 2020-08-25 18:26:49 +02:00
Sebastian Rindom
33e725368d Log error 2020-08-23 17:37:55 +02:00