PHP code example of ivalrivall / laravel-bca

1. Go to this page and download the library: Download ivalrivall/laravel-bca library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ivalrivall / laravel-bca example snippets


'providers' => [
	// blahh.. blahhh..
	Odenktools\Bca\BcaServiceProvider::class,
]

'aliases' => [
	// blahh.. blahhh..
	'Bca'  => Odenktools\Bca\Facades\Bca::class,
]

        'main'        => [
            'corp_id'       => 'your-corp_id',
            'client_id'     => 'your-client_id',
            'client_secret' => 'your-client_secret',
            'api_key'       => 'your-api_key',
            'secret_key'    => 'your-secret_key',
            'timezone'      => 'Asia/Jakarta',
            'host'          => 'sandbox.bca.co.id',
            'scheme'        => 'https',
            'development'   => true,
            'options'       => [],
            'port'          => 443,
            'timeout'       => 30,
        ],

	// Request Login dan dapatkan nilai OAUTH
	$response = \Bca::httpAuth();

	// LIHAT HASIL OUTPUT
	echo json_encode($response);

	// Nilai token yang dihasilkan saat login
	$token = "MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB";

	//Nomor akun yang akan di ambil informasi saldonya, menggunakan ARRAY
	$arrayAccNumber = array('0201245680', '0063001004', '1111111111');

	$response = \Bca::getBalanceInfo($token, $arrayAccNumber);
	
	// LIHAT HASIL OUTPUT
	echo json_encode($response);

	// Nilai token yang dihasilkan saat login
	$token = "MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB";

	$amount = '50000.00';

	// Nilai akun bank anda
	$nomorakun = '0201245680';

	// Nilai akun bank yang akan ditransfer
	$nomordestinasi = '0201245681';

	// Nomor PO, silahkan sesuaikan
	$nomorPO = '12345/PO/2017';

	// Nomor Transaksi anda, Silahkan generate sesuai kebutuhan anda
	$nomorTransaksiID = '00000001';

	$response = \Bca::fundTransfers($token, 
						$amount,
						$nomorakun,
						$nomordestinasi,
						$nomorPO,
						'Testing Saja Ko',
						'Online Saja Ko',
						$nomorTransaksiID);

	echo json_encode($response);

	// Nilai token yang dihasilkan saat login
	$token = "MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB";

	// Nilai akun bank anda
	$nomorakun = '0201245680';
	
	// Tanggal start transaksi anda
	$startdate = '2016-08-29';
	
	// Tanggal akhir transaksi anda
	$enddate = '2016-09-01';

	$response = \Bca::getAccountStatement($token, $nomorakun, $startdate, $enddate);

	echo json_encode($response);

	//Tipe rate :  bn, e-rate, tt, tc
	$rateType = 'e-rate';

	$mataUang = 'usd';

	$response = \Bca::getForexRate($token, $rateType, $mataUang);

	echo json_encode($response);

	$latitude = '-6.1900718';

	$longitude = '106.797190';

	$totalAtmShow = '10';

	$radius = '20';

	$response = \Bca::getAtmLocation($token, $latitude, $longitude, $totalAtmShow, $radius);

	echo json_encode($response);

	// Nilai token yang dihasilkan saat login
	$token = "MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB";

	$response       = \Bca::getDepositRate($token);

	echo json_encode($response);


	$secret = "NILAI-SECRET-ANDA";
	
	// Nilai token yang dihasilkan saat login
	$token = "MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB";
	
	$uriSign = "GET:/general/info-bca/atm";
	
	//Format timestamp harus dalam ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSTZD)
	$isoTime = "2016-02-03T10:00:00.000+07:00";
	
	$bodyData = array();
	
	//nilai body anda disini
	$bodyData['a'] = "BLAAA-BLLLAA";
	$bodyData['b'] = "BLEHH-BLLLAA";
	
	//ketentuan BCA array harus disort terlebih dahulu
	ksort($bodyData);

	$authSignature = \Bca::generateSign($uriSign, $token, $secret, $isoTime, $bodyData);
	
	echo $authSignature;
bash
php artisan vendor:publish --provider="Odenktools\Bca\BcaServiceProvider"

composer dumpautoload