From 3b6323658eab91626a0cd608ab23c70cda581d82 Mon Sep 17 00:00:00 2001
From: nobswebdev
Date: Sat, 5 Sep 2026 14:48:01 +0200
Subject: [PATCH] remove crypto rate display from cart
---
.../services/StorefrontCartService.spec.ts | 26 ++-----------------
.../services/StorefrontCartService.ts | 10 -------
.../views/partials/cart-totals-panel.hbs | 12 ++-------
3 files changed, 4 insertions(+), 44 deletions(-)
diff --git a/backend/src/modules/storefrontCart/services/StorefrontCartService.spec.ts b/backend/src/modules/storefrontCart/services/StorefrontCartService.spec.ts
index ed0c8b3..ef2aa75 100644
--- a/backend/src/modules/storefrontCart/services/StorefrontCartService.spec.ts
+++ b/backend/src/modules/storefrontCart/services/StorefrontCartService.spec.ts
@@ -1,8 +1,6 @@
import { BadRequestException } from '@nestjs/common';
import { DeliveryMode } from '../../product/types/DeliveryMode';
import type { StorefrontProductsService } from '../../storefrontProduct/services/StorefrontProductsService';
-import type { ExchangeRateService } from '../../exchangeRate/services/ExchangeRateService';
-import { PaymentMethod } from '../../payment/types/PaymentMethod';
import type { CookieCartLineExtended } from '../types/CookieCartLineExtended';
import type { StorefrontDiscountService } from './StorefrontDiscountService';
import { StorefrontCartService } from './StorefrontCartService';
@@ -30,9 +28,6 @@ describe('StorefrontCartService', () => {
getStorefrontVariantsByIds: jest.Mock;
getStorefrontVariant: jest.Mock;
};
- let exchangeRateService: {
- getLiveFiatPerCrypto: jest.Mock;
- };
let discountService: {
getDiscountStateForCart: jest.Mock;
applyDiscountCode: jest.Mock;
@@ -44,10 +39,6 @@ describe('StorefrontCartService', () => {
getStorefrontVariant: jest.fn().mockResolvedValue(buildVariant())
};
- exchangeRateService = {
- getLiveFiatPerCrypto: jest.fn().mockReturnValue(150)
- };
-
discountService = {
getDiscountStateForCart: jest.fn().mockResolvedValue({
discounts: [],
@@ -59,7 +50,6 @@ describe('StorefrontCartService', () => {
service = new StorefrontCartService(
productsService as unknown as StorefrontProductsService,
- exchangeRateService as unknown as ExchangeRateService,
discountService as unknown as StorefrontDiscountService
);
});
@@ -99,8 +89,6 @@ describe('StorefrontCartService', () => {
discounts: [],
cartDiscountTotal: 0,
cartTotalPrice: 0,
- cartTotalXmr: null,
- fiatPerXmr: null,
hasManualLines: false,
hasAutoLines: false,
cartTotalIssueMessage: null,
@@ -108,23 +96,13 @@ describe('StorefrontCartService', () => {
});
});
- it('converts the discounted total to XMR when a live rate is available', async () => {
+ it('returns cart totals and delivery flags', async () => {
const summary = await service.getCartSummary([{ variantId, qty: 1 }], []);
expect(summary.cartSubtotal).toBe(10);
expect(summary.cartTotalPrice).toBe(10);
- expect(summary.fiatPerXmr).toBe(150);
- expect(summary.cartTotalXmr).toBe('0.06666667');
expect(summary.hasAutoLines).toBe(true);
- });
-
- it('leaves cartTotalXmr null when no live rate is available', async () => {
- exchangeRateService.getLiveFiatPerCrypto.mockReturnValue(null);
-
- const summary = await service.getCartSummary([{ variantId, qty: 1 }], []);
-
- expect(summary.cartTotalXmr).toBeNull();
- expect(summary.fiatPerXmr).toBeNull();
+ expect(summary.hasIssues).toBe(false);
});
it('flags manual and auto delivery lines separately', async () => {
diff --git a/backend/src/modules/storefrontCart/services/StorefrontCartService.ts b/backend/src/modules/storefrontCart/services/StorefrontCartService.ts
index 34fc757..2ec87a2 100644
--- a/backend/src/modules/storefrontCart/services/StorefrontCartService.ts
+++ b/backend/src/modules/storefrontCart/services/StorefrontCartService.ts
@@ -7,9 +7,6 @@ import type { CookieCart } from '../../storefrontCore/types/cart/CookieCart';
import { getQtyByVariantIdFromCart } from '../../../utils/cart/getQtyByVariantIdFromCart';
import { DeliveryMode } from '../../product/types/DeliveryMode';
import { StorefrontProductsService } from '../../storefrontProduct/services/StorefrontProductsService';
-import { ExchangeRateService } from '../../exchangeRate/services/ExchangeRateService';
-import { PaymentMethod } from '../../payment/types/PaymentMethod';
-import { convertFiatToXmr } from '../../../utils/monero/convertFiatToXmr';
import { CookieCartLineDto } from '../dto/CookieCartLineDto';
import type { CookieCartExtended } from '../types/CookieCartExtended';
import type { CookieCartLineExtended } from '../types/CookieCartLineExtended';
@@ -23,7 +20,6 @@ import { StorefrontDiscountService } from './StorefrontDiscountService';
export class StorefrontCartService {
constructor(
private readonly productsService: StorefrontProductsService,
- private readonly exchangeRateService: ExchangeRateService,
private readonly discountService: StorefrontDiscountService
) {}
@@ -67,8 +63,6 @@ export class StorefrontCartService {
discounts: [],
cartDiscountTotal: 0,
cartTotalPrice: 0,
- cartTotalXmr: null,
- fiatPerXmr: null,
hasManualLines: false,
hasAutoLines: false,
cartTotalIssueMessage: null,
@@ -78,8 +72,6 @@ export class StorefrontCartService {
const cartSubtotal = sumByKey(cartExtended, 'lineSubtotal');
const discountState = await this.discountService.getDiscountStateForCart(discountCodes, cartExtended);
- const fiatPerXmr = this.exchangeRateService.getLiveFiatPerCrypto(PaymentMethod.Xmr);
- const cartTotalXmr = fiatPerXmr !== null ? convertFiatToXmr(discountState.cartTotalPrice, fiatPerXmr) : null;
const hasManualLines = cartExtended.some(line => line.deliveryMode === DeliveryMode.Manual);
const hasAutoLines = cartExtended.some(line => line.deliveryMode === DeliveryMode.Auto);
const cartTotalIssueMessage = getZeroCartTotalIssue(discountState.cartTotalPrice, cartExtended.length > 0);
@@ -92,8 +84,6 @@ export class StorefrontCartService {
cartExtended,
cartSubtotal,
...discountState,
- cartTotalXmr,
- fiatPerXmr,
hasManualLines,
hasAutoLines,
cartTotalIssueMessage,
diff --git a/backend/src/modules/storefrontCore/views/partials/cart-totals-panel.hbs b/backend/src/modules/storefrontCore/views/partials/cart-totals-panel.hbs
index 05235a8..0a83e79 100644
--- a/backend/src/modules/storefrontCore/views/partials/cart-totals-panel.hbs
+++ b/backend/src/modules/storefrontCore/views/partials/cart-totals-panel.hbs
@@ -52,13 +52,6 @@
{{cartTotalPrice}}
{{shopFiatCurrency}}
- {{#if cartTotalXmr}}
- = {{cartTotalXmr}} XMR
- {{else}}
-
- We couldn't determine the XMR rate right now. Please try again later.
-
- {{/if}}