Example #1
0
 protected function createXml($name)
 {
     $xml = parent::createXml($name);
     $xml->customerProfileId = $this->profileId;
     return $xml;
 }
 protected function createXml($name)
 {
     $xml = parent::createXml($name);
     $xml->transaction->profileTransAuthCapture->amount = $this->doFirst ? $this->invoice->first_total : $this->invoice->second_total;
     $xml->transaction->profileTransAuthCapture->tax->amount = $this->doFirst ? $this->invoice->first_tax : $this->invoice->second_tax;
     $xml->transaction->profileTransAuthCapture->shipping->amount = $this->doFirst ? $this->invoice->first_shipping : $this->invoice->second_shipping;
     foreach ($this->invoice->getItems() as $item) {
         /* @var $item InvoiceItem */
         $line = $xml->transaction->profileTransAuthCapture->addChild('lineItems');
         $line->itemId = $item->item_id;
         $line->name = substr($item->item_title, 0, 30);
         $line->quantity = $item->qty;
         $price = $this->doFirst ? $item->first_price : $item->second_price;
         if ($price) {
             $line->unitPrice = $price;
         }
         if ($this->doFirst ? $item->first_tax : $item->second_tax) {
             $line->taxable = 'true';
         } else {
             $line->taxable = 'false';
         }
     }
     $user = $this->invoice->getUser();
     $taxAmount = $this->doFirst ? $this->invoice->first_tax : $this->invoice->second_tax;
     if ($taxAmount) {
         $xml->transaction->profileTransAuthCapture->tax->amount = $taxAmount;
     }
     $xml->transaction->profileTransAuthCapture->customerProfileId = $user->data()->get(Am_Paysystem_AuthorizeCim::USER_PROFILE_KEY);
     $xml->transaction->profileTransAuthCapture->customerPaymentProfileId = $user->data()->get(Am_Paysystem_AuthorizeCim::PAYMENT_PROFILE_KEY);
     $xml->transaction->profileTransAuthCapture->order->description = $this->invoice->getLineDescription();
     $xml->transaction->profileTransAuthCapture->order->purchaseOrderNumber = $this->invoice->public_id . '-' . $this->invoice->getPaymentsCount();
     $xml->transaction->profileTransAuthCapture->recurringBilling = $this->doFirst ? 'true' : 'false';
     return $xml;
 }