| @@ -158,20 +158,26 @@ | ||
| 158 | 158 | $billing_address2 = PayplugWoocommerceHelper::is_pre_30() ? $order->billing_address_2 : $order->get_billing_address_2(); |
| 159 | 159 | $billing_postcode = PayplugWoocommerceHelper::is_pre_30() ? $order->billing_postcode : $order->get_billing_postcode(); |
| 160 | 160 | $billing_city = PayplugWoocommerceHelper::is_pre_30() ? $order->billing_city : $order->get_billing_city(); |
| 161 | 161 | $billing_country = PayplugWoocommerceHelper::is_pre_30() ? $order->billing_country : $order->get_billing_country(); |
| 162 | + $billing_company = PayplugWoocommerceHelper::is_pre_30() ? $order->billing_company : $order->get_billing_company(); | |
| 163 | + if (empty($billing_company)) { | |
| 164 | + $billing_company = $billing_first_name .' '. $billing_last_name; | |
| 165 | + } | |
| 166 | + | |
| 162 | 167 | if ( ! PayplugWoocommerceHelper::is_country_supported( $billing_country ) ) { |
| 163 | 168 | $billing_country = PayplugWoocommerceHelper::get_default_country(); |
| 164 | 169 | } |
| 165 | 170 | |
| 166 | 171 | $this->billing = [ |
| 167 | - 'first_name' => $this->limit_length( $billing_first_name ), | |
| 168 | - 'last_name' => $this->limit_length( $billing_last_name ), | |
| 169 | - 'email' => $this->limit_length( $billing_email, 255 ), | |
| 170 | - 'address1' => $this->limit_length( $billing_address1, 255 ), | |
| 171 | - 'postcode' => $this->limit_length( $billing_postcode, 16 ), | |
| 172 | - 'city' => $this->limit_length( $billing_city ), | |
| 173 | - 'country' => $this->limit_length( $billing_country, 2 ), | |
| 172 | + 'first_name' => $this->limit_length( $billing_first_name ), | |
| 173 | + 'last_name' => $this->limit_length( $billing_last_name ), | |
| 174 | + 'email' => $this->limit_length( $billing_email, 255 ), | |
| 175 | + 'address1' => $this->limit_length( $billing_address1, 255 ), | |
| 176 | + 'postcode' => $this->limit_length( $billing_postcode, 16 ), | |
| 177 | + 'city' => $this->limit_length( $billing_city ), | |
| 178 | + 'country' => $this->limit_length( $billing_country, 2 ), | |
| 179 | + 'company_name' => $this->limit_length( $billing_company ) | |
| 174 | 180 | ]; |
| 175 | 181 | |
| 176 | 182 | if ( ! empty( $billing_address2 ) ) { |
| 177 | 183 | $this->billing['address2'] = $this->limit_length( $billing_address2, 255 ); |
| @@ -193,8 +199,14 @@ | ||
| 193 | 199 | $shipping_address2 = PayplugWoocommerceHelper::is_pre_30() ? $order->shipping_address_2 : $order->get_shipping_address_2(); |
| 194 | 200 | $shipping_postcode = PayplugWoocommerceHelper::is_pre_30() ? $order->shipping_postcode : $order->get_shipping_postcode(); |
| 195 | 201 | $shipping_city = PayplugWoocommerceHelper::is_pre_30() ? $order->shipping_city : $order->get_shipping_city(); |
| 196 | 202 | $shipping_country = PayplugWoocommerceHelper::is_pre_30() ? $order->shipping_country : $order->get_shipping_country(); |
| 203 | + $shipping_company = PayplugWoocommerceHelper::is_pre_30() ? $order->shipping_company : $order->get_shipping_company(); | |
| 204 | + | |
| 205 | + if (empty($shipping_company)) { | |
| 206 | + $shipping_company = $shipping_first_name .' '. $shipping_last_name; | |
| 207 | + } | |
| 208 | + | |
| 197 | 209 | if ( ! PayplugWoocommerceHelper::is_country_supported( $shipping_country ) ) { |
| 198 | 210 | $shipping_country = PayplugWoocommerceHelper::get_default_country(); |
| 199 | 211 | } |
| 200 | 212 | |
| @@ -204,9 +216,10 @@ | ||
| 204 | 216 | 'email' => $this->limit_length( $shipping_email, 255 ), |
| 205 | 217 | 'address1' => $this->limit_length( $shipping_address1, 255 ), |
| 206 | 218 | 'postcode' => $this->limit_length( $shipping_postcode, 16 ), |
| 207 | 219 | 'city' => $this->limit_length( $shipping_city ), |
| 208 | - 'country' => $this->limit_length( $shipping_country, 2 ), | |
| 220 | + 'country' => $this->limit_length( $shipping_country, 2 ), | |
| 221 | + 'company_name' => $this->limit_length( $shipping_company ) | |
| 209 | 222 | ]; |
| 210 | 223 | |
| 211 | 224 | if ( ! empty( $shipping_address2 ) ) { |
| 212 | 225 | $this->shipping['address2'] = $this->limit_length( $shipping_address2, 255 ); |
| @@ -261,8 +274,9 @@ | ||
| 261 | 274 | } |
| 262 | 275 | |
| 263 | 276 | if ( PhoneNumberType::MOBILE === $phone_number_util->getNumberType( $phone_number ) ) { |
| 264 | 277 | $this->billing['mobile_phone_number'] = $phone_number_util->format( $phone_number, PhoneNumberFormat::E164 ); |
| 278 | + $this->shipping['mobile_phone_number'] = $phone_number_util->format( $phone_number, PhoneNumberFormat::E164 ); | |
| 265 | 279 | } else { |
| 266 | 280 | $this->billing['landline_phone_number'] = $phone_number_util->format( $phone_number, PhoneNumberFormat::E164 ); |
| 267 | 281 | } |
| 268 | 282 | } catch ( \Exception $e ) { |