diff --git a/packages/core/e2e/channel.e2e-spec.ts b/packages/core/e2e/channel.e2e-spec.ts index ef8b2fd7bf..18a7e831af 100644 --- a/packages/core/e2e/channel.e2e-spec.ts +++ b/packages/core/e2e/channel.e2e-spec.ts @@ -11,17 +11,16 @@ import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; -import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; +import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; +import * as Codegen from './graphql/generated-e2e-admin-types'; import { - ChannelFragment, CurrencyCode, DeletionResult, ErrorCode, LanguageCode, Permission, } from './graphql/generated-e2e-admin-types'; -import * as Codegen from './graphql/generated-e2e-admin-types'; import { ASSIGN_PRODUCT_TO_CHANNEL, CREATE_ADMINISTRATOR, @@ -123,6 +122,20 @@ describe('Channels', () => { }); }); + it('update currencyCode', async () => { + const { updateChannel } = await adminClient.query< + Codegen.UpdateChannelMutation, + Codegen.UpdateChannelMutationVariables + >(UPDATE_CHANNEL, { + input: { + id: 'T_1', + currencyCode: CurrencyCode.MYR, + }, + }); + channelGuard.assertSuccess(updateChannel); + expect(updateChannel.currencyCode).toBe('MYR'); + }); + it('superadmin has all permissions on new channel', async () => { const { me } = await adminClient.query(ME); diff --git a/packages/core/src/service/services/channel.service.ts b/packages/core/src/service/services/channel.service.ts index b3a8d88133..e197af5423 100644 --- a/packages/core/src/service/services/channel.service.ts +++ b/packages/core/src/service/services/channel.service.ts @@ -290,6 +290,9 @@ export class ChannelService { const seller = await this.connection.getEntityOrThrow(ctx, Seller, input.sellerId); updatedChannel.seller = seller; } + if (input.currencyCode) { + updatedChannel.defaultCurrencyCode = input.currencyCode; + } await this.connection.getRepository(ctx, Channel).save(updatedChannel, { reload: false }); await this.customFieldRelationService.updateRelations(ctx, Channel, input, updatedChannel); await this.allChannels.refresh(ctx);