protected function addBillingData(\SimpleXMLElement $data)
    {
        /** @var mixed $req */
        $req = $data->transactionRequest;

        // The order must come before the customer ID.
        $req->order->invoiceNumber = $this->getInvoiceNumber();
        $req->order->description = $this->getDescription();

        // Merchant assigned customer ID
        $customer = $this->getCustomerId();
        if (!empty($customer)) {
            $req->customer->id = $customer;
        }

        //$req->order->description = $this->getDescription();

        /** @var CreditCard $card */
        if ($card = $this->getCard()) {
            // A card is present, so include billing and shipping details
            $req->customer->email = $card->getEmail();

            $req->billTo->firstName = $card->getBillingFirstName();
            $req->billTo->lastName = $card->getBillingLastName();
            $req->billTo->company = $card->getBillingCompany();
            $req->billTo->address = trim($card->getBillingAddress1() . " \n" . $card->getBillingAddress2());
            $req->billTo->city = $card->getBillingCity();
            $req->billTo->state = $card->getBillingState();
            $req->billTo->zip = $card->getBillingPostcode();
            $req->billTo->country = $card->getBillingCountry();
            $req->billTo->phoneNumber = $card->getBillingPhone();

            $req->shipTo->firstName = $card->getShippingFirstName();
            $req->shipTo->lastName = $card->getShippingLastName();
            $req->shipTo->company = $card->getShippingCompany();
            $req->shipTo->address = trim($card->getShippingAddress1() . " \n" . $card->getShippingAddress2());
            $req->shipTo->city = $card->getShippingCity();
            $req->shipTo->state = $card->getShippingState();
            $req->shipTo->zip = $card->getShippingPostcode();
            $req->shipTo->country = $card->getShippingCountry();
        }

        return $data;
    }
protected function addBillingData(\SimpleXMLElement $data)
    {
        /** @var mixed $req */
        $req = $data->transactionRequest;

        // The order must come before the customer ID.
        $req->order->invoiceNumber = $this->getInvoiceNumber();
        $req->order->description = $this->getDescription();

        // Merchant assigned customer ID
        $customer = $this->getCustomerId();
        if (!empty($customer)) {
            $req->customer->id = $customer;
        }

        //$req->order->description = $this->getDescription();

        /** @var CreditCard $card */
        if ($card = $this->getCard()) {
            // A card is present, so include billing and shipping details
            $req->customer->email = $card->getEmail();

            $req->billTo->firstName = $card->getBillingFirstName();
            $req->billTo->lastName = $card->getBillingLastName();
            $req->billTo->company = $card->getBillingCompany();
            $req->billTo->address = trim($card->getBillingAddress1() . " \n" . $card->getBillingAddress2());
            $req->billTo->city = $card->getBillingCity();
            $req->billTo->state = $card->getBillingState();
            $req->billTo->zip = $card->getBillingPostcode();
            $req->billTo->country = $card->getBillingCountry();
            $req->billTo->phoneNumber = $card->getBillingPhone();

            $req->shipTo->firstName = $card->getShippingFirstName();
            $req->shipTo->lastName = $card->getShippingLastName();
            $req->shipTo->company = $card->getShippingCompany();
            $req->shipTo->address = trim($card->getShippingAddress1() . " \n" . $card->getShippingAddress2());
            $req->shipTo->city = $card->getShippingCity();
            $req->shipTo->state = $card->getShippingState();
            $req->shipTo->zip = $card->getShippingPostcode();
            $req->shipTo->country = $card->getShippingCountry();
        }

        return $data;
    }
protected function addBillingData ( \ SimpleXMLElement $ data ) { /** @var mixed $req */ $ req = $ data -> transactionRequest ; // The order must come before the customer ID. $ req -> order -> invoiceNumber = $ this -> getInvoiceNumber ( ) ; $ req -> order -> description = $ this -> getDescription ( ) ; // Merchant assigned customer ID $ customer = $ this -> getCustomerId ( ) ; if ( ! empty ( $ customer ) ) { $ req -> customer -> id = $ customer ; } //$req->order->description = $this->getDescription(); /** @var CreditCard $card */ if ( $ card = $ this -> getCard ( ) ) { // A card is present, so include billing and shipping details $ req -> customer -> email = $ card -> getEmail ( ) ; $ req -> billTo -> firstName = $ card -> getBillingFirstName ( ) ; $ req -> billTo -> lastName = $ card -> getBillingLastName ( ) ; $ req -> billTo -> company = $ card -> getBillingCompany ( ) ; $ req -> billTo -> address = trim ( $ card -> getBillingAddress1 ( ) . " \n" . $ card -> getBillingAddress2 ( ) ) ; $ req -> billTo -> city = $ card -> getBillingCity ( ) ; $ req -> billTo -> state = $ card -> getBillingState ( ) ; $ req -> billTo -> zip = $ card -> getBillingPostcode ( ) ; $ req -> billTo -> country = $ card -> getBillingCountry ( ) ; $ req -> billTo -> phoneNumber = $ card -> getBillingPhone ( ) ; $ req -> shipTo -> firstName = $ card -> getShippingFirstName ( ) ; $ req -> shipTo -> lastName = $ card -> getShippingLastName ( ) ; $ req -> shipTo -> company = $ card -> getShippingCompany ( ) ; $ req -> shipTo -> address = trim ( $ card -> getShippingAddress1 ( ) . " \n" . $ card -> getShippingAddress2 ( ) ) ; $ req -> shipTo -> city = $ card -> getShippingCity ( ) ; $ req -> shipTo -> state = $ card -> getShippingState ( ) ; $ req -> shipTo -> zip = $ card -> getShippingPostcode ( ) ; $ req -> shipTo -> country = $ card -> getShippingCountry ( ) ; } return $ data ; }
Adds billing data to a partially filled request data object.

@param \SimpleXMLElement $data

@return \SimpleXMLElement
Adds billing data to a partially filled request data object .