コード例 #1
0
ファイル: Payment.php プロジェクト: nordsoftware/paytrail-php
 /**
  * Convert the payment object to an array.
  *
  * @return array
  */
 public function toArray()
 {
     $array = array();
     $array['orderNumber'] = $this->orderNumber;
     if (isset($this->referenceNumber)) {
         $array['referenceNumber'] = $this->referenceNumber;
     }
     if (isset($this->description)) {
         $array['description'] = $this->description;
     }
     $array['currency'] = $this->currency;
     if (isset($this->locale)) {
         $array['locale'] = $this->locale;
     }
     $array['orderDetails'] = array('includeVat' => $this->vatMode, 'products' => array());
     if ($this->urlSet !== null) {
         $array['urlSet'] = $this->urlSet->toArray();
     }
     if ($this->contact !== null) {
         $array['orderDetails']['contact'] = $this->contact->toArray();
     }
     foreach ($this->products as $product) {
         $array['orderDetails']['products'][] = $product->toArray();
     }
     return $array;
 }
コード例 #2
0
 /**
  * Creates a Contact.
  *
  * @return Contact
  */
 protected function makeContact()
 {
     $contact = new Contact();
     $contact->configure(array('firstName' => 'Test', 'lastName' => 'Person', 'email' => '*****@*****.**', 'phoneNumber' => '040123456', 'companyName' => 'Demo Company Ltd', 'address' => $this->makeAddress()));
     return $contact;
 }