Skip to content

Commit

Permalink
feat(picqer): always invoicename and deliveryname
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug committed Oct 25, 2023
1 parent e882ed2 commit 24d7382
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/vendure-plugin-picqer/src/api/picqer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1089,14 +1089,14 @@ export class PicqerService implements OnApplicationBootstrap {
reference: order.code,
emailaddress: order.customer?.emailAddress ?? '',
telephone: order.customer?.phoneNumber ?? '',
deliveryname,
deliveryname: deliveryname ?? customerFullname,
deliverycontactname,
deliveryaddress: this.getFullAddress(shippingAddress),
deliveryzipcode: shippingAddress.postalCode,
deliverycity: shippingAddress.city,
deliverycountry: shippingAddress.countryCode?.toUpperCase(),
// use billing if available, otherwise fallback to shipping address
invoicename,
invoicename: invoicename ?? deliveryname ?? customerFullname,
invoicecontactname,
invoiceaddress:
this.getFullAddress(billingAddress) ??
Expand Down Expand Up @@ -1128,7 +1128,9 @@ export class PicqerService implements OnApplicationBootstrap {
* If a company is given, use the company as name and the full name as contact name
* Otherwise, use the full name as name and no explicit contact name
*/
private getAddressName(address?: OrderAddress): [string, string | undefined] {
private getAddressName(
address?: OrderAddress
): [string | undefined, string | undefined] {
let name;
let contactname;
if (address?.company) {
Expand Down

0 comments on commit 24d7382

Please sign in to comment.