public function toArray()
 {
     $data = parent::toArray();
     $idx = 0;
     if (!is_null($this->_paymentDetails)) {
         foreach ($this->_paymentDetails as $paymentDetail) {
             $paymentDetail->setPrefix("PAYMENTREQUEST_{$idx}_");
             $data = array_merge($data, $paymentDetail->toArray());
             $idx++;
         }
     }
     //parse shipping options
     if (!is_null($this->_shippingOptions)) {
         $option = $this->_shippingOptions;
         for ($i = 0; $i < count($option); $i++) {
             if (!$option[$i] instanceof ExpressShippingOption) {
                 continue;
             }
             $data["L_SHIPPINGOPTIONNAME{$i}"] = $option[$i]->getName();
             $data["L_SHIPPINGOPTIONAMOUNT{$i}"] = $option[$i]->getAmount();
             $data["L_SHIPPINGOPTIONISDEFAULT{$i}"] = $option[$i]->getDefault();
         }
     }
     return $data;
 }
Exemple #2
0
 public function toArray()
 {
     $data = parent::toArray();
     if (!is_null($this->_shippingOptions)) {
         $option = $this->_shippingOptions;
         for ($i = 0; $i < count($option); $i++) {
             if (!$option[$i] instanceof ExpressShippingOption) {
                 continue;
             }
             $data["L_SHIPPINGOPTIONNAME{$i}"] = $option[$i]->getName();
             $data["L_SHIPPINGOPTIONLABEL{$i}"] = $option[$i]->getLabel();
             $data["L_SHIPPINGOPTIONAMOUNT{$i}"] = $option[$i]->getAmount();
             $data["L_TAXAMT{$i}"] = $option[$i]->getTaxAmount();
             $data["L_INSURANCEAMOUNT{$i}"] = $option[$i]->getInsuranceAmount();
             $data["L_SHIPPINGOPTIONISDEFAULT{$i}"] = $option[$i]->getDefault();
         }
     }
     return $data;
 }
 public function toArray()
 {
     $data = parent::toArray();
     $data = array_merge($data, $this->_paymentDetails->toArray());
     if (!is_null($this->_address)) {
         //get address
         $address = $this->_address->toArray();
         if (isset($address['PHONENUM'])) {
             $address['SHIPTOPHONENUM'] = $address['PHONENUM'];
             unset($address['PHONENUM']);
         }
         $data = array_merge($data, $address);
     }
     if (!is_null($this->_shipAddress)) {
         $shipAddress = $this->_shipAddress->toArray();
         $tmp = array();
         foreach ($shipAddress as $key => $value) {
             $tmp["SHIPTO{$key}"] = $value;
         }
         $data = array_merge($data, $tmp);
     }
     return $data;
 }
 public function toArray()
 {
     $data = parent::toArray();
     //parse payment details
     if (is_null($this->_paymentDetails)) {
         throw new \Exception("Missing payment details.");
     }
     $idx = 0;
     foreach ($this->_paymentDetails as $paymentDetail) {
         $paymentDetail->setPrefix("PAYMENTREQUEST_{$idx}_");
         $data = array_merge($data, $paymentDetail->toArray());
         $idx++;
     }
     return $data;
 }