Skip to content

Commit a732ad1

Browse files
committed
fix: prevent error with undefined isBillingAddress var
1 parent d740832 commit a732ad1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

functions/lib/integration/exports/address-to-horus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const parsePhone = (phone) => {
1212
return number.substring(start, number.length)
1313
}
1414

15-
module.exports = async (horus, customerCodeHorus, customerAddress, isBillingAddress) => {
15+
module.exports = async (horus, customerCodeHorus, customerAddress) => {
1616
const zipCode = parseZipCode(customerAddress.zip) || 0
1717
console.log('> Address Customer => CLI: ', customerCodeHorus, ' ZipCode: ', zipCode)
1818

functions/lib/integration/exports/orders-to-horus.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ module.exports = async ({ appSdk, storeId, auth }, orderId, opts = {}) => {
6464
const transaction = order.transactions && order.transactions.length && order.transactions[0]
6565
const paymentMethodCode = transaction && transaction.payment_method.code
6666
const shippingLine = order.shipping_lines && order.shipping_lines.length && order.shipping_lines[0]
67-
const shippingApp = shippingLine && shippingLine.app
68-
69-
const isShippingAddress = shippingLine?.to?.zip
70-
const customerAddress = isShippingAddress
71-
? shippingLine?.to
67+
const shippingApp = shippingLine?.app
68+
const customerAddress = shippingLine?.to?.zip
69+
? shippingLine.to
7270
: transaction?.billing_address
7371

7472
if (!order.financial_status) {
@@ -127,7 +125,7 @@ module.exports = async ({ appSdk, storeId, auth }, orderId, opts = {}) => {
127125
const zipCode = parseZipCode(customerAddress.zip)
128126
let addressCustomerHorus = await getClientAddressByZipCode(horus, customerCodeHorus, zipCode)
129127
if (!addressCustomerHorus) {
130-
addressCustomerHorus = await createAddress(horus, customerCodeHorus, customerAddress, isBillingAddress)
128+
addressCustomerHorus = await createAddress(horus, customerCodeHorus, customerAddress)
131129
}
132130

133131
if (!orderHorus) {

0 commit comments

Comments
 (0)