feat(core-flows,medusa): Add API to update cart's customer (#10151)

what:

- adds an endpoint that updates a cart's customer

RESOLVES CMRC-718
This commit is contained in:
Riqwan Thamir
2024-11-19 12:44:25 +01:00
committed by GitHub
parent 41dc05d0c9
commit b7044bb3b0
13 changed files with 462 additions and 101 deletions

View File

@@ -1,6 +1,6 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
generatePublishableKey,
generateStoreHeaders,
@@ -31,7 +31,8 @@ medusaIntegrationTestRunner({
it("should create a customer address", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
appContainer
api,
storeHeaders
)
const response = await api.post(

View File

@@ -1,6 +1,6 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
generatePublishableKey,
generateStoreHeaders,
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
it("should delete a customer address", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
appContainer
api,
storeHeaders
)
const address = await customerModuleService.createCustomerAddresses({
@@ -65,7 +66,7 @@ medusaIntegrationTestRunner({
})
it("should fail to delete another customer's address", async () => {
const { jwt } = await createAuthenticatedCustomer(appContainer)
const { jwt } = await createAuthenticatedCustomer(api, storeHeaders)
const otherCustomer = await customerModuleService.createCustomers({
first_name: "Jane",

View File

@@ -28,7 +28,8 @@ medusaIntegrationTestRunner({
it("should retrieve auth user's customer", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
appContainer
api,
storeHeaders
)
const response = await api.get(`/store/customers/me`, {
@@ -41,7 +42,7 @@ medusaIntegrationTestRunner({
id: customer.id,
first_name: "John",
last_name: "Doe",
email: "john@me.com",
email: "tony@start.com",
})
)
})

View File

@@ -1,6 +1,6 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
generatePublishableKey,
generateStoreHeaders,
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
it("should get all customer addresses and its count", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
appContainer
api,
storeHeaders
)
await customerModuleService.createCustomerAddresses([

View File

@@ -1,6 +1,6 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
generatePublishableKey,
generateStoreHeaders,
@@ -32,7 +32,8 @@ medusaIntegrationTestRunner({
it.only("should update a customer address", async () => {
const { customer, jwt } = await createAuthenticatedCustomer(
appContainer
api,
storeHeaders
)
const address = await customerModuleService.createCustomerAddresses({
@@ -66,7 +67,7 @@ medusaIntegrationTestRunner({
})
it("should fail to update another customer's address", async () => {
const { jwt } = await createAuthenticatedCustomer(appContainer)
const { jwt } = await createAuthenticatedCustomer(api, storeHeaders)
const otherCustomer = await customerModuleService.createCustomers({
first_name: "Jane",