public static function fromArray($data)
 {
     $batch = new BatchResponseInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($batch), $key)) {
             if ($key == "transactions_detail") {
                 $myArray = array();
                 foreach ($value as $keys => $val) {
                     $_tmp = TransactionReportInformation::fromArray($val);
                     $myArray[] = $_tmp;
                 }
                 $batch->{$key} = $myArray;
             } elseif ($key == "errors") {
                 $batch->{$key} = Errors::fromArray($value);
             } elseif ($key == "batch_info") {
                 $batch->{$key} = BatchInfo::fromArray($value);
             } else {
                 $batch->{$key} = $value;
             }
         }
     }
     return $batch;
 }
示例#2
0
 public static function fromArray($data)
 {
     $refund = new RefundInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($refund), $key)) {
             if ($key == "errors") {
                 $refund->{$key} = Errors::fromArray($value);
             }
             if ($key == "lastRecurringBillResponse") {
                 $refund->{$key} = RefundResponse::fromArray($value);
             } else {
                 $refund->{$key} = $value;
             }
         }
     }
     return $refund;
 }
 public static function fromArray($data)
 {
     $verif = new VerifyResponseInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($verif), $key)) {
             if ($key == "verifyResponse") {
                 $verif->{$key} = VerifyResponse::fromArray($value);
             } elseif ($key == "errors") {
                 $verif->{$key} = Errors::fromArray($value);
             } else {
                 $verif->{$key} = $value;
             }
         }
     }
     return $verif;
 }
 public static function fromArray($data)
 {
     $trn = new TransactionReportInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($trn), $key)) {
             if ($key == "errors") {
                 $trn->{$key} = Errors::fromArray($value);
             } else {
                 $trn->{$key} = $value;
             }
         }
     }
     return $trn;
 }
 public function closeBatch($id)
 {
     if (is_null($id) || $id == "") {
         return null;
     }
     $url = $this->getUrl() . Batch::$BATCH_LINK . $id;
     $request = $this->setHeadersPatch($url, $this->_oauthToken);
     $result = $this->doPatchForBatch($request);
     if (array_key_exists('errors', $result)) {
         $errors_tmp = new Errors();
         foreach ($result as $errorData) {
             $errors_tmp = Errors::fromArray($errorData);
         }
         $errors[] = $errors_tmp;
         return $errors;
     } else {
         $response = Batch::fromArray($result);
         return $response;
     }
 }
 public static function fromArray($data)
 {
     $sale = new SaleResponseInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($sale), $key)) {
             if ($key == "saleResponse") {
                 $sale->{$key} = SaleResponse::fromArray($value);
             } elseif ($key == "errors") {
                 $sale->{$key} = Errors::fromArray($value);
             } else {
                 $sale->{$key} = $value;
             }
         }
     }
     return $sale;
 }
 public static function fromArray($data)
 {
     if (!is_null($data)) {
         $err = null;
         $tri = new TransactionReportInformation();
         foreach ($data as $key => $value) {
             if (property_exists(get_class($tri), $key)) {
                 $tri->{$key} = $value;
             } else {
                 $err[] = $value;
             }
         }
         if (!is_null($err)) {
             $tri->errors = Errors::fromArray($err);
         }
         return $tri;
     }
 }
 /**
  * @param $datos
  * @param $type
  * @param $operationId
  */
 public function addMetadata($metadata, $type, $operationId)
 {
     $metadataUrl = null;
     if (TransactionType::Sale == $type) {
         $metadataUrl = $this->_url . "metadata/forSale/" . $operationId;
     }
     if (TransactionType::AuthOnly == $type) {
         $metadataUrl = $this->_url . "metadata/forAuthOnly/" . $operationId;
     }
     if (TransactionType::Capture == $type) {
         $metadataUrl = $this->_url . "metadata/forCapture/" . $operationId;
     }
     if (TransactionType::Bill == $type) {
         $metadataUrl = $this->_url . "metadata/forBill/" . $operationId;
     }
     if (TransactionType::CardData == $type) {
         $metadataUrl = $this->_url . "metadata/forCardData/" . $operationId;
     }
     if (TransactionType::Customer == $type) {
         $metadataUrl = $this->_url . "metadata/forCustomer/" . $operationId;
     }
     if (TransactionType::Merchant == $type) {
         $metadataUrl = $this->_url . "metadata/forMerchant/" . $operationId;
     }
     if (TransactionType::RecurringBill == $type) {
         $metadataUrl = $this->_url . "metadata/forRecurringBill/" . $operationId;
     }
     if (TransactionType::Schedule == $type) {
         $metadataUrl = $this->_url . "metadata/forSchedule/" . $operationId;
     }
     if (TransactionType::Refund == $type) {
         $metadataUrl = $this->_url . "metadata/forRefund/" . $operationId;
     }
     if (TransactionType::VoidTransaction == $type) {
         $metadataUrl = $this->_url . "metadata/forVoid/" . $operationId;
     }
     $request = $this->setHeadersPut($metadataUrl, $this->_oauthToken);
     $result = $this->doPut($request, $metadata);
     if (is_array($result)) {
         foreach ($result as $errorData) {
             $errors_tmp = Errors::fromArray($errorData);
         }
         $errors[] = $errors_tmp;
         return $errors;
     } else {
         return true;
     }
 }
 public static function fromArray($data)
 {
     $auth = new AuthorizationResponseInformation();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($auth), $key)) {
             if ($key == "authOnlyResponse") {
                 $auth->{$key} = AuthOnlyResponse::fromArray($value);
             } elseif ($key == "errors") {
                 $auth->{$key} = Errors::fromArray($value);
             } else {
                 $auth->{$key} = $value;
             }
         }
     }
     return $auth;
 }