Merged PR 1404: #3471 Zusätzliche addressen werden nun gespeichert

#3471 Zusätzliche addressen werden nun gespeichert

Related work items: #3471
This commit is contained in:
Lorenz Hilpert
2022-10-14 11:36:44 +00:00
committed by Andreas Schickinger
parent b2b5456400
commit 65d7a6f5a4
2 changed files with 17 additions and 15 deletions

View File

@@ -447,22 +447,24 @@ export class CrmCustomerService {
return this.customerService.CustomerEmailExists(email);
}
createPayer(customerId: number, payer: PayerDTO, isDefault?: boolean): Observable<[Result<PayerDTO>, Result<AssignedPayerDTO>]> {
return this.getCustomer(customerId).pipe(
mergeMap((customerResponse) =>
this.payerService
.PayerCreatePayer({ ...payer, payerType: customerResponse.result.customerType })
.pipe(
mergeMap((payerResponse) =>
this.customerService
.CustomerAddPayerReference({ customerId: customerId, payerId: payerResponse.result.id, isDefault: isDefault })
.pipe(
map((assigendPayerResponse) => [payerResponse, assigendPayerResponse] as [Result<PayerDTO>, Result<AssignedPayerDTO>])
)
createPayer(customerId: number, payer: PayerDTO, isDefault?: boolean): Promise<[Result<PayerDTO>, Result<AssignedPayerDTO>]> {
return this.getCustomer(customerId)
.pipe(
mergeMap((customerResponse) =>
this.payerService
.PayerCreatePayer({ ...payer, payerType: customerResponse.result.customerType })
.pipe(
mergeMap((payerResponse) =>
this.customerService
.CustomerAddPayerReference({ customerId: customerId, payerId: payerResponse.result.id, isDefault: isDefault })
.pipe(
map((assigendPayerResponse) => [payerResponse, assigendPayerResponse] as [Result<PayerDTO>, Result<AssignedPayerDTO>])
)
)
)
)
)
)
);
.toPromise();
}
updatePayer(customerId: number, payerId: number, payer: PayerDTO, isDefault?: boolean): Observable<Result<PayerDTO>> {

View File

@@ -104,7 +104,7 @@ export abstract class PayerCreateComponent implements OnInit {
}
try {
await this.customerService.createPayer(this.customerId, this.control.value, this.control.value.isDefault).toPromise();
await this.customerService.createPayer(this.customerId, this.control.value, this.control.value.isDefault);
this.location.back();
} catch (err) {
this.control.enable();