#1526 Setzen der Rechnugsadresse bei Online und B2B Kunden

This commit is contained in:
Lorenz Hilpert
2021-03-11 13:34:42 +01:00
parent 5bbc3e3b1e
commit 8cac8512ab

View File

@@ -335,6 +335,19 @@ export class DomainCheckoutService {
shareReplay()
);
const customerTypes$ = this.getCustomerFeatures({ processId }).pipe(
first(),
map((features) => {
const isOnline = !!features?.webshop;
const isGuest = !!features?.guest;
const isB2B = !!features?.b2b;
const hasCustomerCard = !!features?.p4mUser;
const isStaff = !!features?.staff;
return { isOnline: isOnline, isGuest, isB2B, hasCustomerCard, isStaff };
})
);
const shippingAddressDestination$ = this.getCheckout({ processId }).pipe(
first(),
map((checkout) => checkout?.destinations?.find((dest) => dest.data.target === 2 || dest.data.target === 16)),
@@ -346,9 +359,9 @@ export class DomainCheckoutService {
mergeMap((buyer) => this._setBuyer({ processId, buyer }))
);
const setPayer$ = itemOrderOptions$.pipe(
mergeMap((options) => {
if (options.hasB2BDelivery || options.hasDelivery || options.hasDigDelivery || options.hasDownload) {
const setPayer$ = customerTypes$.pipe(
mergeMap(({ isOnline, isB2B }) => {
if (isOnline || isB2B) {
return this.getPayer({ processId }).pipe(first());
}
return of(undefined);