composer require loki1729/laravel-thepeer
Following are some ways through which you can access the ThePeer provider:
// Import the class namespaces first, before using it directly
use \Loki1729\LaravelThePeer\Services\ThePeer as ThePeerClient;
$the_peer_service = new ThePeerClient;
php artisan vendor:publish --provider "Loki1729\LaravelThePeer\ServiceProviders\ThePeerServiceProvider"
The configuration file loki_the_peer.php is located in the config folder. Following are its contents when published:
return [
'mode' => env('THE_PEER_MODE', 'sandbox'), // Can only be 'sandbox' Or 'live'. If empty or invalid, 'live' will be used.
'sandbox' => [
'public_key' => env('THE_PEER_TEST_PUBLIC_KEY', ''),
'secret_key' => env('THE_PEER_TEST_SECRET_KEY', ''),
],
'live' => [
'public_key' => env('THE_PEER_LIVE_PUBLIC_KEY', ''),
'secret_key' => env('THE_PEER_LIVE_SECRET_KEY', ''),
],
];
You can either use the env to set your keys or use your keys as shown in the example below:
$the_peer_service = new ThePeerClient($mode, $secret_key);
For local testing, the "mode" is set to "sandbox";
$the_peer_service = new ThePeerClient('sandbox', 'secret-key');
For Live testing, the "mode" is set to "live";
$the_peer_service = new ThePeerClient('live', 'secret-key');
$the_peer_service->indexUser(string $name, string $email, string $identifier);
$the_peer_service->allUsers(int $page = null, int $perPage = null);
$the_peer_service->updateUser(string $userReference, string $identifier);
$the_peer_service->deleteUSer(string $userReference);
$the_peer_service->getUserLink(string $userReference);
$the_peer_service->getTransaction(string $transactionId);
$the_peer_service->refundTransaction(string $transactionId, string $reason);
$the_peer_service->getLink(string $linkId);
$the_peer_service->chargeLink(string $linkId, float $amount, string $remark);
$the_peer_service->testCredit(float $amount, string $currency, string $user_reference);
$the_peer_service->testCharge(float $amount, string $from, string $to, string $currency, string $remark, string $channel);