Exemplo n.º 1
0
 /**
  * Get a webhook authorization code.
  *
  * @return object
  */
 public function getAuthorizationCode()
 {
     return $this->client->get(self::ENDPOINT);
 }
Exemplo n.º 2
0
 /**
  * Create a payment source.
  *
  * @param  string $name    A meaningful name that will help you identify the source in Web Self Care environment
  * @param  string $code    A unique code that is exchanged between your application and the API
  * @param  string $url     The primary domain of your site WITH protocol scheme (http/https)
  * @param  string $fail    The relative path url your client will end up to, after a failed transaction
  * @param  string $success The relative path url your client will end up to, after a successful transaction
  * @return object
  */
 public function create($name, $code, $url, $fail, $success)
 {
     $uri = new Uri($url);
     return $this->client->post(self::ENDPOINT, [\GuzzleHttp\RequestOptions::FORM_PARAMS => ['Name' => $name, 'SourceCode' => $code, 'Domain' => $this->getDomain($uri), 'isSecure' => $this->isSecure($uri), 'PathFail' => $fail, 'PathSuccess' => $success]]);
 }
Exemplo n.º 3
0
 /**
  * Check for installments support.
  *
  * @param  mixed $number  The credit card number
  * @return int
  */
 public function installments($number)
 {
     $response = $this->client->get(self::ENDPOINT . '/installments', [\GuzzleHttp\RequestOptions::HEADERS => ['CardNumber' => $this->normalizeNumber($number)], \GuzzleHttp\RequestOptions::QUERY => ['key' => $this->getKey()]]);
     return $response->MaxInstallments;
 }
 /**
  * Cancel or refund a payment.
  *
  * @param  string       $id
  * @param  int          $amount
  * @param  string|null  $actionUser
  * @return object
  */
 public function cancel($id, $amount, $actionUser = null)
 {
     $query = ['Amount' => $amount];
     $actionUser = $actionUser ? ['ActionUser' => $actionUser] : [];
     return $this->client->delete(self::ENDPOINT . $id, [\GuzzleHttp\RequestOptions::QUERY => array_merge($query, $actionUser)]);
 }
Exemplo n.º 5
0
 /**
  * Get the checkout URL for an order.
  *
  * @param  int $orderCode  The unique Payment Order ID.
  * @return \GuzzleHttp\Psr7\Uri
  */
 public function getCheckoutUrl($orderCode)
 {
     return Uri::withQueryValue($this->client->getUrl()->withPath('web/checkout'), 'ref', $orderCode);
 }