Commit Graph

152 Commits

Author SHA1 Message Date
Philip Korsholm
0394be36ef Feat: bulk delete customers from customer group (#1097)
* integration testing

* customer seeder

* initial bulk removal

* integraiton testing of deletes

* delete fix

* not found test

* remove unused code

* Apply suggestions from code review

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

* update integration tests

* pr review fixes

* update migration

* formatting

* integration tests for deletion

* pr feedback

* fix failing integration tests

* remove integration tests before merging

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-25 15:29:13 +01: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
Frane Polić
694e2df20f feat: customer group update (#1098) 2022-02-24 18:03:20 +01:00
Philip Korsholm
e35a4fb2ea Feat: Delete customer group (#1102) 2022-02-24 14:20:58 +01:00
Zakaria El Asri
cb7b211c9b fix: variant price update (#1093)
* fix: variant prices update + integration tests

* add: unit tests

* fix: rename variable

* add: integration tests

* fix: integration tests

* fix: test name

* fix: move db logic to repo layer + create upsert method

* fix: linting
2022-02-22 20:23:11 +01:00
Frane Polić
1909d20e48 Merge pull request #1073 from medusajs/feat/get-customer-group
feat: get customer group
2022-02-22 09:37:07 +01:00
Frane Polić
75fb2ce9c3 feat: update customer groups (#1075)
* update customer service prep

* expand on the update customer groups test case

* add the test case for customer group update

* docs for `groups` prop on update customer endpoint

* refactor, update comments

* expend on integration tests, add customer mock with a group

* refactor to use `customerGroupService.list` method

* update units

* remove `updateCustomerGroups`

* fix rebase conflict

* fix customer seed data, add JoinTable on groups

* group retrieval using the expand param

* fix: use `buildQuery_`

* fix: validation for `groups`, enable `expand`param on update customer endpoint

* fix: remove fileds form the `FilterableCustomerGroupProps`

* fix: spearate body/query validation

Co-authored-by: fPolic <frane@medusajs.com>
2022-02-21 16:24:38 +01:00
fPolic
f21454970c fix: typo in an assertion 2022-02-21 15:26:28 +01:00
fPolic
ecd6ed820e feat: add extend param for customer groups 2022-02-21 15:24:52 +01:00
fPolic
8313680a71 fix: integration test case 2022-02-21 14:33:20 +01:00
fPolic
963b594a8a test for the 404 case 2022-02-21 13:56:41 +01:00
fPolic
21d99a44a9 feat: GET customer group endpoint 2022-02-21 13:56:23 +01:00
Zakaria El Asri
c2241d1101 fix: allow offset and limit in products free text search (#1082) 2022-02-18 11:39:32 +01:00
Philip Korsholm
b16976a6f4 Feat: Create customer group (#1074)
* fix babel transform-runtime regenerator required for migrations

* add customer group model

* add migration for customer group

* add customer group model export

* add customer group repository

* add customer group service

* add CustomerGroupRepository to "withTransaction" in CustomerGroupService

* remove unnecessary argument to runtime plugin

* service export ordering

* add create customer group endpoint

* add customergroup to route index in admin

* add customer group service

* add customer groups test

* cleanup

* duplicate error handling

* ducplicate name integration test

* add jsdoc

* customergroup not customer

* pr feedback

* pipeline test

* fix weird merge

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-18 09:58:54 +01:00
Adrien de Peretti
22d387dcce Feat(medusajs) Allow to pass custom headers (#1009)
* Feat(medusajs) Allow to pass custom headers

* fix: axios exprexted output

* fix: integration test cart

* refactor: Update types object > Record<string, any>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-17 16:50:03 +01:00
Oliver Windall Juhl
9f4a9f7db4 Add expand to /admin/customers/:id (#1070)
* fix: 1055 add expand to /admin/customers/:id

* fix tests

* fix tests
2022-02-16 23:41:30 +01:00
Kasper Fabricius Kristensen
66294038f0 feat: add and remove products to/from collection in bulk endpoints (#1032)
* adds bulk add/remove products to/from collection. Adds endpoint updateProducts on collections that uses these bulk operations

* fix integration tests and test description

* undo change to swap

* made requested changes

* added removeProducts endpoint

* made requested changes

* fix: set collection_id null

* updated collection_id to type string | undefined
2022-02-16 22:45:19 +01:00
Philip Korsholm
8141e12a3d add pagination and date filtering to regions (#976) 2022-02-10 09:15:07 +01:00
Kasper Fabricius Kristensen
ff9e2e58cb adds ability to update balance to 0 and adds integration test (#1036) 2022-02-10 09:11:32 +01:00
Kasper Fabricius Kristensen
d2a7534615 fix: admin collections default relations (#1023)
* added default relations to retrieve collection endpoint

* push snapshot

* added created at and updated at to collection list endpoint

* updated integration tests

* added q param to list collections

* updated snapshots
2022-02-04 16:24:42 +01:00
Oliver Windall Juhl
59bb413245 fix: Updating store currencies (#984)
* fix: Adds default currency to store currencies on create

* fix: Adds integration tests + currency update error handling

* add test

* Lowercase currency codes

* fix tests

* fix: Await drop database to stop Jest from complaining

* revert itnegration tests fix

* fix store tests
2022-02-03 20:03:25 +01:00
Sebastian Rindom
3bf32e5dc9 fix: adds order by functionality to products (#1021)
* fix: adds order by functionality to products

* feat: adds product tags list

* fix: adds client and react support for product tags

* fix: unit test

* Update packages/medusa/src/services/product-tag.ts

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

* Update packages/medusa/src/services/product-tag.ts

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

* Update packages/medusa/src/services/product-tag.ts

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

* Update packages/medusa/src/services/product-tag.ts

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

* Update packages/medusa/src/services/product-tag.ts

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

* Update packages/medusa/src/services/product-tag.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>
2022-02-03 19:03:15 +01:00
Philip Korsholm
24175025d1 Fix: admin list products expand integration test (#974) 2022-02-02 08:35:16 +01:00
Philip Korsholm
7fcdac51ea Feat: object notation in queryparams (#1002)
* add object notation for queryparams

* test rule.type query params in list-discount

* pr feedback
2022-02-01 17:31:12 +01:00
Philip Korsholm
f4f9653efc Feat: admin collections filtering (#977)
* collections filtering

* filtering collection tests

* oas for list collections
2022-02-01 17:24:47 +01:00
Oliver Windall Juhl
fdc493df7f fix: Support array of payment status filters when listing orders (#1013) 2022-02-01 17:24:13 +01:00
Philip Korsholm
f61eaeec12 feat: expand store product filtering (#973) 2022-01-11 16:06:16 +01:00
SaintMalik
0f9fbbb732 docs: Fix typos in docs (#497) 2022-01-04 16:35:38 +01:00
Philip Korsholm
d1b8f4b50b Feat: Extend user api (#460)
* api routes for user management

* add invites and roles to db

* services

* invite repo

* include user in accepting invitation

* include user role in create user

* api password reset

* delete invite

* include email in reset password token

* added metadata as dbawarecolumn

* added events for invite handling and delete functionality

* added invite model to exports

* add default value member and allow null roles

* conditional inclusion of invites in "list-users"

* integration tests for users

* helpers for user testing

* add unauthenticated routes to users

* simplifying create invite

* create users with first and last name, and dev role

* reset password endpoint

* removed token from response

* update user with firstname, lastname and role

* create invite refactor

* test password reset without email in body

* removed redundant router variable

* cleanup

* unit tests

* adjustments

* service tests

* adjustments according to api changes

* fix cart test

* cloned now works

* change name to verified token for the verified token

* add a space

* db aware columns

* fix: timestampz dbaware

* more testing

* add list-invites endpoint

* reset-password error handling

* pr issues adjusted

* fixed test

* add optional to link templates

* move invites to a new endpoint

* migrate invites to own testsuite

* adjust snapshots

* email constraint for invite

* fix integration tests

* addressing pr feedback

* unit tests for extended user api

* linting

* fix integration tests

* fix unit tests

* fix: Addresses breaking change from class-transformer

* fix orders testing

* merge "create-claim" js and ts files

* add out commented tests

* update typescript endpoints to reflect changes made for user management

* converted invites to typescript

* add exports from api endpoints

* remove old js files used for reference

* integration test

* import reflect metadata

* invite service conversion to ts

* removed unused import

* update invite service to match styleguide

* add "expires_at" and "token" to invite table

* update invite service to save tokens and validate expires_at

* fix failing tests

* fix tests after adding token and expires_at to invite

* add expiration to create

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
2021-12-08 10:15:22 +01:00
Kasper Fabricius Kristensen
577bcc23d4 feat: medusa-source-shopify loader (#563)
* added statuses to product + unit test for updating status

* add update to product model

* added integration tests

* added integration test to validate that updating status to null results in invalid_data error

* removed comment

* update GET /store/products integration test

* fixed unit test with IdMap

* init plugin

* changed dbehaviour on invalid status input on admin list products

* mprices

* updated migration to add status = published on all existing products + added integration test on GET /admin/products when status null is provided

* merged product status

* init ShopifyService

* made requested changes to migration and GET /store/products

* fixed test

* made requested changes to migration

* push progress on source plugin

* add webhook product/create handler

* fixed normalization of variant weight

* removed weight func

* work on events

* finished product hooks (error on new variant needs to be fixed)

* fixed order status

* create fulfillments

* update fulfillment on cancel

* refactored services, handle returns though medusa, helper methods

* order updates

* removed dist

* update gitignore

* emit cahnges to product

* added redis ignore check to prevent update loops

* fixed product-variant.deleted event

* fix more events

* fix test

* fix: order taxes

* added refund with no items

* fixes to hooks

* fixed handling refunds and returns issued from Shopify

* added unit tests to ShopifyProductService and ShopifyCollectionService

* linting fix

* prepared loader PR

* fix: jsDocs

* fix: pager

* fix: build output and babelrc

* chore: linting

* fix: address type

* fix: migration clean up

* fix: update snapshots with ext_ids

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2021-12-08 10:09:21 +01:00
Sebastian Rindom
ed04132533 fix(medusa): migrate cart service to typescript (#884)
* fix: migrate cart service to typescript

* fix: jsdoc inventory service

* fix: revert route unit test change

* fix: typo

* fix: revert integration test packages

* fix: cleanup

* fix: tests

* fix: integration tests

* fix: create props type guards

* fix: move total field to common types
2021-12-07 19:26:00 +01:00
Oliver Windall Juhl
6579c13111 feat: Admin shipping options routes to Typescript (#891) 2021-12-07 17:07:23 +01:00
Zakaria El Asri
74bc9c618f fix: create cart with items (#851)
* fix: create cart with items

* remove: verbose mode

* fix: unit test
2021-12-01 10:53:01 +01:00
olivermrbl
72c5030da3 Merge branch 'master' into develop 2021-11-22 13:40:55 +01:00
Oliver Windall Juhl
f387b4919f fix: Addresses breaking change from library class-transformer (#835)
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
2021-11-22 13:39:38 +01:00
Sebastian Rindom
59761163c2 chore: merge release 2021-11-20 15:59:31 +01:00
Derek Wene
ebb7c0aa53 Fix: admin api create customer (#826) 2021-11-20 11:50:28 +01:00
Derek Wene
2d9879ea09 feat: admin api - allow customers to be created and updated with metadata (#824)
* feat: admin api - allow customers to be created and updated with metadata

* feat: add integration test for metadata
2021-11-18 18:50:36 +01:00
Oliver Windall Juhl
373532ecbc feat: Typescript for API layer (#817)
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
Co-authored-by: Zakaria El Asri <33696020+zakariaelas@users.noreply.github.com>
Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
Co-authored-by: Sebastian Rindom <seb@medusa-commerce.com>
2021-11-18 15:19:17 +01:00
Oliver Windall Juhl
1e50aee4fe feat: Allow retrieval of soft-deleted products (#723) 2021-11-10 22:23:56 +01:00
Sebastian Rindom
7ecfe207de hotfix: joins discounts when creating claims (#760)
* fix: join discounts when creating claims

* fix: rm verbose/only

* fix: rm dup tests
2021-11-09 12:27:38 +01:00
Sebastian Rindom
e0fa06fe96 fix: make it possible to update order shipping address (#668) 2021-11-05 16:48:29 +01:00
Sebastian Rindom
45b344fbe1 fix: add product count to storefront (#719) 2021-11-04 15:32:48 +01:00
Zakaria El Asri
0a65eca3de fix: delete region causes cascade error (#672)
Co-authored-by: olivermrbl <oliver@mrbltech.com>
2021-11-03 15:19:46 +01:00
Sebastian Rindom
692cccf53a Merge remote-tracking branch 'origin/master' into develop 2021-11-03 14:13:58 +01:00
Sebastian Rindom
a5fe1c2e28 fix: include discount rule in swap retrieval (#682) 2021-11-03 14:11:27 +01:00
Sebastian Rindom
e82737a035 fix: adds options to default relations in storefront product endpoints (#712) 2021-11-03 13:15:36 +01:00
Sebastian Rindom
58127564d7 feat(medusa): adds collection endpoints to storefront (#711)
Adds:
- `/store/collections/:id`
- `/store/collections`
2021-11-03 11:24:45 +01:00
Philip Korsholm
68c2a4fe3a Fix/polish discount (#569)
* formatting and optional "is_dynamic" on updates

* formatting

* uppercasing discount code on update

* multiple regions fail with fixed discounts

* discount testing

* testing

* spelling

* removed comment

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2021-10-26 13:20:38 +02:00
Sebastian Rindom
531075208f Merge remote-tracking branch 'origin/master' into develop 2021-10-24 14:08:45 +02:00