Skip to content

Commit

Permalink
fix: display correct label for VAT inclusion on cost summary
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Apr 28, 2020
1 parent e0ae3f3 commit 910e643
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/app/core/facades/account.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
getLoggedInUser,
getPasswordReminderError,
getPasswordReminderSuccess,
getPriceDisplayType,
getUserAuthorized,
getUserError,
getUserLoading,
Expand Down Expand Up @@ -98,6 +99,7 @@ export class AccountFacade {
// CUSTOMER
customer$ = this.store.pipe(select(getLoggedInCustomer));
isBusinessCustomer$ = this.store.pipe(select(isBusinessCustomer));
userPriceDisplayType$ = this.store.pipe(select(getPriceDisplayType));

updateCustomerProfile(customer: Customer, message?: string) {
this.store.dispatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<!-- Tax -->
<!-- ToDo: display tax in dependence of price calculation preferences -->
<ng-container *ngIf="totals.taxTotal && totals.taxTotal.value">
<dt class="col-6">{{ 'checkout.tax.text' | translate }}</dt>
<dt class="col-6">{{ taxTranslation$ | async | translate }}</dt>
<dd class="col-6" data-testing-id="basket-tax">{{ totals.taxTotal | ishPrice }}</dd>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('Basket Cost Summary Component', () => {
$595.00
checkout.cart.payment_cost.label
$3.57
checkout.tax.text
checkout.tax.TaxesLabel.TotalOrderVat
$22,747.55
checkout.order.total_cost.label
$142,470.71
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { AccountFacade } from 'ish-core/facades/account.facade';
import { BasketTotal } from 'ish-core/models/basket-total/basket-total.model';
import { PriceHelper } from 'ish-core/models/price/price.model';

Expand All @@ -16,8 +19,17 @@ import { PriceHelper } from 'ish-core/models/price/price.model';
templateUrl: './basket-cost-summary.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BasketCostSummaryComponent {
export class BasketCostSummaryComponent implements OnInit {
@Input() totals: BasketTotal;

taxTranslation$: Observable<string>;
invert = PriceHelper.invert;

constructor(private accountFacade: AccountFacade) {}

ngOnInit() {
this.taxTranslation$ = this.accountFacade.userPriceDisplayType$.pipe(
map(type => (type === 'net' ? 'checkout.tax.text' : 'checkout.tax.TaxesLabel.TotalOrderVat'))
);
}
}
2 changes: 1 addition & 1 deletion src/assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@
"checkout.tax.TaxesLabel.Estimated_SalesTax": "Estimated Sales Tax",
"checkout.tax.TaxesLabel.Estimated_TotalOrderVat": "VAT incl. in Order Total",
"checkout.tax.TaxesLabel.SalesTax": "Sales Tax",
"checkout.tax.TaxesLabel.TotalOrderVat": "VAT incl. in Order Total",
"checkout.tax.TaxesLabel.TotalOrderVat": "VAT incl. in Total",
"checkout.tax.TaxesLabel.TotalOrderVat.short": "VAT incl.",
"checkout.tax.calculated_at_checkout.text": "will be calculated at checkout",
"checkout.tax.duLabel": "Duties and Fees",
Expand Down

0 comments on commit 910e643

Please sign in to comment.