<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['expire_at' => '2020-12-12'];
try {
    $api = new Gerencianet($options);
    $charge = $api->updateBillet($params, $body);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['limit' => 20, 'offset' => 0];
try {
    $api = new Gerencianet($options);
    $plans = $api->getPlans($params, []);
    print_r($plans);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
try {
    $api = new Gerencianet($options);
    $subscription = $api->detailSubscription($params, []);
    print_r($subscription);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$paymentToken = 'payment_token';
$customer = ['name' => 'Gorbadoc Oldbuck', 'cpf' => '04267484171', 'phone_number' => '5144916523', 'email' => '*****@*****.**', 'birth' => '1977-01-15'];
$billingAddress = ['street' => 'Av. JK', 'number' => 909, 'neighborhood' => 'Bauxita', 'zipcode' => '35400000', 'city' => 'Ouro Preto', 'state' => 'MG'];
$body = ['payment' => ['credit_card' => ['billing_address' => $billingAddress, 'payment_token' => $paymentToken, 'customer' => $customer]]];
try {
    $api = new Gerencianet($options);
    $subscription = $api->paySubscription($params, $body);
    print_r($subscription);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
Exemple #5
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$items = [['name' => 'Item 1', 'amount' => 1, 'value' => 1000], ['name' => 'Item 2', 'amount' => 2, 'value' => 2000]];
$body = ['items' => $items];
try {
    $api = new Gerencianet($options);
    $charge = $api->createCharge([], $body);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
Exemple #6
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['token' => 'token'];
try {
    $api = new Gerencianet($options);
    $notification = $api->getNotification($params, []);
    print_r($notification);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['notification_url' => 'http://localhost.com', 'custom_id' => 'Custom Subscription 0001'];
try {
    $api = new Gerencianet($options);
    $subscription = $api->updateSubscriptionMetadata($params, $body);
    print_r($subscription);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['custom_id' => 'Carnet 0001', 'notification_url' => 'http://domain.com/notification'];
try {
    $api = new Gerencianet($options);
    $carnet = $api->updateCarnetMetadata($params, $body);
    print_r($carnet);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['custom_id' => 'Product 0001', 'notification_url' => 'http://domain.com/notification'];
try {
    $api = new Gerencianet($options);
    $charge = $api->updateChargeMetadata($params, $body);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
try {
    $api = new Gerencianet($options);
    $plan = $api->deletePlan($params, []);
    print_r($plan);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
try {
    $api = new Gerencianet($options);
    $subscription = $api->cancelSubscription($params, []);
    print_r($subscription);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0, 'parcel' => 1];
$body = ['expire_at' => '2018-01-01'];
try {
    $api = new Gerencianet($options);
    $carnet = $api->updateParcel($params, $body);
    print_r($carnet);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['description' => 'This carnet is about a service'];
try {
    $api = new Gerencianet($options);
    $response = $api->createCarnetHistory($params, $body);
    print_r($response);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$items = [['name' => 'Item 1', 'amount' => 1, 'value' => 1000], ['name' => 'Item 2', 'amount' => 2, 'value' => 2000]];
$body = ['items' => $items];
try {
    $api = new Gerencianet($options);
    $subscription = $api->createSubscription($params, $body);
    print_r($subscription);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['email' => '*****@*****.**'];
try {
    $api = new Gerencianet($options);
    $response = $api->resendCarnet($params, $body);
    print_r($response);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['email' => '*****@*****.**'];
try {
    $api = new Gerencianet($options);
    $response = $api->resendBillet($params, $body);
    print_r($response);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
 public function get_installments()
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     if ($order_info) {
         $data['total'] = number_format(floatval($order_info['total'] * 100), 0, '', '');
         $data['brand'] = $this->request->post['brand'];
         $options = $this->gerencianet_config_payment_api();
         $params = array('total' => $data['total'], 'brand' => $data['brand']);
         try {
             $api = new Gerencianet($options);
             $installments = $api->getInstallments($params, array());
             $this->result_api($installments, true);
         } catch (GerencianetException $e) {
             $errorResponse = array("code" => $e->code, "error" => $e->error, "message" => $e->errorDescription);
             $this->result_api($errorResponse, false);
         } catch (Exception $e) {
             $errorResponse = array("code" => 0, "message" => $e->getMessage());
             $this->result_api($errorResponse, false);
         }
     }
 }
Exemple #18
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$customer = ['name' => 'Gorbadoc Oldbuck', 'cpf' => '04267484171', 'phone_number' => '5144916523'];
$body = ['payment' => ['banking_billet' => ['expire_at' => '2018-12-12', 'customer' => $customer]]];
try {
    $api = new Gerencianet($options);
    $charge = $api->payCharge($params, $body);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$body = ['name' => 'My plan', 'interval' => 2, 'repeats' => null];
try {
    $api = new Gerencianet($options);
    $plan = $api->createPlan([], $body);
    print_r($plan);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
Exemple #20
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$options = json_decode(__DIR__ . '/../config.json', true);
$params = ['id' => 0];
try {
    $api = new Gerencianet($options);
    $charge = $api->cancelCharge($params, []);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0, 'parcel' => 0];
$body = ['email' => '*****@*****.**'];
try {
    $api = new Gerencianet($options);
    $response = $api->resendParcel($params, $body);
    print_r($response);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
$body = ['description' => 'This charge was not fully paid'];
try {
    $api = new Gerencianet($options);
    $response = $api->createChargeHistory($params, $body);
    print_r($response);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
Exemple #23
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$items = [['name' => 'Item 1', 'amount' => 1, 'value' => 1000], ['name' => 'Item 2', 'amount' => 2, 'value' => 2000]];
$customer = ['name' => 'Gorbadoc Oldbuck', 'cpf' => '04267484171', 'phone_number' => '5144916523'];
$body = ['items' => $items, 'customer' => $customer, 'expire_at' => '2020-12-02', 'repeats' => 5, 'split_items' => false];
try {
    $api = new Gerencianet($options);
    $carnet = $api->createCarnet([], $body);
    print_r($carnet);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
Exemple #24
0
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['id' => 0];
try {
    $api = new Gerencianet($options);
    $charge = $api->detailCharge($params, []);
    print_r($charge);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../config.json');
$options = json_decode($file, true);
$params = ['total' => '20000', 'brand' => 'visa'];
try {
    $api = new Gerencianet($options);
    $installments = $api->getInstallments($params, []);
    print_r($installments);
} catch (GerencianetException $e) {
    print_r($e->code);
    print_r($e->error);
    print_r($e->errorDescription);
} catch (Exception $e) {
    print_r($e->getMessage());
}