Example #1
0
 /**
  * Update a customer.
  *
  * @param   array $data API data for customer update
  * @param   Payplug\Payplug $payplug the client configuration
  *
  * @return  null|Customer the new Customer instance
  *
  * @throws  Payplug\Exception\ConfigurationNotSetException
  */
 public function update(array $data, Payplug\Payplug $payplug = null)
 {
     if ($payplug === null) {
         $payplug = Payplug\Payplug::getDefaultConfiguration();
     }
     $httpClient = new Payplug\Core\HttpClient($payplug);
     $response = $httpClient->patch(Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::CUSTOMER_RESOURCE, $this->id), $data);
     return Payment::fromAttributes($response['httpResponse']);
 }
Example #2
0
 /**
  * Aborts a Payment.
  *
  * @param   Payplug\Payplug    $payplug    the client configuration
  *
  * @return  null|Payment the aborted payment or null on error
  *
  * @throws  Payplug\Exception\ConfigurationNotSetException
  */
 public function abort(Payplug\Payplug $payplug = null)
 {
     if ($payplug === null) {
         $payplug = Payplug\Payplug::getDefaultConfiguration();
     }
     $httpClient = new Payplug\Core\HttpClient($payplug);
     $response = $httpClient->patch(Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::PAYMENT_RESOURCE, $this->id), array('abort' => true));
     return Payment::fromAttributes($response['httpResponse']);
 }