PHP code example of serverfireteam / efinance
1. Go to this page and download the library: Download serverfireteam/efinance 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/ */
serverfireteam / efinance example snippets
'providers' => array(
Serverfireteam\Efinance\EfinanceServiceProvider::class
)
Route::get('/short', function(){
$bef = new Serverfireteam\Efinance\bef_submitNewApplicationShort();
$bef->build_proposal('ClientReference', 'Ch1');
$bef->build_proposal('CashPrice', 1000);
$bef->build_customer('Title', 'Mr');
$bef->build_customer('Forename', 'Test');
$bef->build_customer('Surname', 'Person');
$bef->build_customer('EmailAddress', '[email protected] ');
$bef->build_customer('EmailAddress', '[email protected] ');
$bef->build_address('HouseNumber', '1');
$bef->build_address('Street', 'A Street');
$bef->build_address('District', 'A Locality');
$bef->build_address('Town', 'A Town');
$bef->build_address('County', 'A County');
$bef->build_address('Postcode', 'A1 1AA');
$bef->build_goods('Fp1', 'Security items', 1);
$bef->call();
echo 'Token:<br />';
echo $bef->get_token();
echo '<br /><br />Proposal ID:<br />';
echo $bef->get_proposal_id();
});
Route::get('/', function(){
$bef = new Serverfireteam\Efinance\bef_submitNewApplication();
$bef->build_proposal('ProposalTypeCode', 'FTBNPS');
$bef->build_proposal('InterestRateType', 1);
$bef->build_proposal('InterestRate', '9.84');
$bef->build_proposal('Term', 5);
$bef->build_proposal('DeferralPeriod', 6);
$bef->build_proposal('ClientReference', 'A11');
$bef->build_proposal('CashPrice', 600);
$bef->build_proposal('Deposit', 0);
$bef->build_proposal('ThirdPartyCharge', 0);
$bef->build_customer('Title', 'Mr');
$bef->build_customer('Forename', 'Test');
$bef->build_customer('Surname', 'Person');
$bef->build_customer('EmailAddress', '[email protected] ');
$bef->build_address('HouseNumber', '1');
$bef->build_address('Street', 'A Street');
$bef->build_address('District', 'A Locality');
$bef->build_address('Town', 'A Town');
$bef->build_address('County', 'A County');
$bef->build_address('Postcode', 'A1 1AA');
$bef->build_goods('CY0', 'Generic Bike', 1);
$bef->build_goods('CY0', 'Generic Bike 2', 1);
$bef->build_goods('CY0', 'Generic Bike 3', 1);
$bef->call();
echo 'Token:<br />';
echo $bef->get_token();
echo '<br /><br />Proposal ID:<br />';
echo $bef->get_proposal_id();
});
$bef = new Serverfireteam\Efinance\bef_cancelAgreement();
$bef->build_customer('Title', 'Mr');
$bef->build_customer('Forename', 'Test');
$bef->build_customer('Surname', 'Person');
$bef->build_customer('EmailAddress', '[email protected] ');
$bef->build_agreement('AgreementNumber', '1');
$bef->build_agreement('OriginalLoanAdvance', '1000.00');
$bef->build_agreement('CancellationAmount', '1000.00');
$bef->build_agreement('NewLoanAdvance', '0.00');
$bef->build_agreement('CancellationType', 'full');
$bef->build_agreement('ClientRequestReference', 'A4');
$bef->call();
$bef = new Serverfireteam\Efinance\bef_submitNotificationBatch();
$bef->build_batch_reference('Test Batch');
$bef->build_notifications('8435', '', 'A7', '600.00');
$bef->build_notifications('8435', '', 'A7', '600.00');
$bef->build_notifications('8435', '', 'A7', '600.00');
$bef->call();
echo 'Batch ID:<br />';
echo $bef->get_batch_id();
echo '<br /><br />Total Accepted:<br />';
echo $bef->get_total_accepted();
echo '<br /><br />Total Rejected:<br />';
echo $bef->get_total_rejected();
if($bef->get_total_rejected() > 0)
{
$rejections = $bef->get_rejection_reasons();
echo '<pre>'; print_r($rejections); echo '</pre>';
}
$bef = new Serverfireteam\Efinance\bef_notificationBatchEnquiry();
$bef->add_data('BatchID', 1234);
$bef->add_data('Reference', 'Test Batch');
$bef->call();
$bef = new Serverfireteam\Efinance\bef_proposalEnquiry();
$bef->add_data('ClientReference', 'A4');
$bef->add_data('ProposalID', 8323);
$bef->call();
bash
php artisan vendor:publish