function get_order_customer($order_summary)
{
    $name = !empty($order_summary['billing_company']) ? $order_summary['billing_company'] : $order_summary['billing_name'];
    $customer = new KontrahentFlyweightBuilder($name, $order_summary['billing_postcode'], $order_summary['billing_city']);
    if (!empty($order_summary['tax_number'])) {
        $customer->NIP($order_summary['tax_number']);
    }
    if (!empty($order_summary['billing_street_address'])) {
        $address = $order_summary['billing_street_address'];
        $customer->Ulica($address);
    }
    if (!empty($order_summary['billing_telephone'])) {
        $customer->Telefon($order_summary['billing_telephone']);
    }
    if (!($order_summary['billing_company'] != $order_summary['customers_company'] || $order_summary['billing_name'] != $order_summary['customers_name'])) {
        if (!empty($order_summary['customers_id'])) {
            $customer->Identyfikator('IFI' . $order_summary['customers_id']);
        }
    }
    return $customer;
}
function get_order_customer($order_summary)
{
    //$cust_summary = get_customer($order_summary['customer_id']);
    //$cust_addr = get_customer_invoice_address($order_summary['id_address_invoice']);
    $name = !empty($order_summary['payment_company']) ? $order_summary['payment_company'] : $order_summary['payment_lastname'] . " " . $order_summary['payment_firstname'];
    $customer = new KontrahentFlyweightBuilder($name, $order_summary['payment_postcode'], $order_summary['payment_city']);
    //	if( ! empty( $order_summary['vat_number']) ){
    //		$customer->NIP($order_summary['vat_number']);
    //	}
    if (!empty($order_summary['payment_address1'])) {
        $address = $order_summary['payment_address1'];
        if (!empty($order_summary['payment_address2'])) {
            $address .= ' ' . $order_summary['payment_address2'];
        }
        $customer->Ulica($address);
    }
    if (!empty($order_summary['telephone'])) {
        $customer->Telefon($order_summary['telephone']);
    }
    if (!($order_summary['payment_firstname'] != $order_summary['payment_firstname'] || $order_summary['payment_lastname'] != $order_summary['payment_lastname'])) {
        if (!empty($order_summary['customer_id'])) {
            $customer->Identyfikator('IFI' . $order_summary['customer_id']);
        }
    }
    return $customer;
}