Beispiel #1
0
 /**
  * Gets a sale
  * @param GUID $paymentId 
  * @return mixed
  */
 public function get($paymentId)
 {
     $uri = BraspagApiConfig::apiQueryUri . "sales/{$paymentId}";
     $response = \Httpful\Request::get($uri)->sendsJson()->addHeaders($this->headers)->send();
     if ($response->code == BraspagHttpStatus::Ok) {
         $sale = new BraspagSale();
         $sale->merchantOrderId = $response->body->MerchantOrderId;
         $sale->customer = $this->parseCustomer($response->body->Customer);
         $sale->payment = $this->parsePayment($response->body->Payment);
         return $sale;
     } elseif ($response->code == BraspagHttpStatus::BadRequest) {
         return BraspagUtils::getBadRequestErros($response->body);
     }
     return $response->code;
 }
 /**
  * Deactivate one recurrent payment
  * @param mixed $recurrentId 
  */
 public function reactivate($recurrentId, $amount)
 {
     $uri = BraspagApiConfig::apiUri . "RecurrentPayment/{$recurrentId}/Reactivate";
     $response = \Httpful\Request::put($uri)->addHeaders($this->headers)->addHeader("content-type", "text/json")->send();
     if ($response->code == BraspagHttpStatus::BadRequest) {
         return BraspagUtils::getBadRequestErros($response->body);
     }
     return $response->code;
 }