add multi-crypto payment buttons to cart
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { Body, Controller, Get, HttpStatus, Post, Req, Res, UseFilters } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { Throttle } from '@nestjs/throttler';
|
||||
import type { Request, Response } from 'express';
|
||||
import { throttleProfiles } from '../../../config/throttleProfiles';
|
||||
import type { Config } from '../../../types/Config';
|
||||
import { paymentMethodLabel } from '../../../consts/paymentMethodLabel';
|
||||
import { StorefrontExceptionFilter } from '../../storefrontCore/filters/StorefrontExceptionFilter';
|
||||
import { StorefrontCartCookieService } from '../../storefrontCore/services/StorefrontCartCookieService';
|
||||
import { StorefrontCheckoutSessionCookieService } from '../../storefrontCore/services/StorefrontCheckoutSessionCookieService';
|
||||
@@ -33,7 +36,8 @@ export class StorefrontCartController {
|
||||
private readonly feedbackCookieService: StorefrontFeedbackCookieService,
|
||||
private readonly checkoutSessionCookieService: StorefrontCheckoutSessionCookieService,
|
||||
private readonly captchaService: StorefrontCaptchaService,
|
||||
private readonly captchaCookieService: StorefrontCaptchaCookieService
|
||||
private readonly captchaCookieService: StorefrontCaptchaCookieService,
|
||||
private readonly configService: ConfigService
|
||||
) {}
|
||||
|
||||
@Get('shop/cart')
|
||||
@@ -62,9 +66,17 @@ export class StorefrontCartController {
|
||||
|
||||
this.captchaCookieService.setAnswer(req, res, encryptedAnswer);
|
||||
|
||||
const { enabledPaymentMethods } = this.configService.get('shopSettings') as Config['shopSettings'];
|
||||
|
||||
const paymentMethods = enabledPaymentMethods.map(paymentMethod => ({
|
||||
paymentMethod,
|
||||
paymentMethodLabel: paymentMethodLabel[paymentMethod]
|
||||
}));
|
||||
|
||||
return res.render('cart-summary', {
|
||||
...summary,
|
||||
...shopLocals,
|
||||
paymentMethods,
|
||||
captchaSvg
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user