veripark/tariff-engine-sdk

Veripark Tariff Engine COMPOSER SDK

This package's canonical repository appears to be gone and the package has been frozen as a result.

dev-master 2022-07-04 12:33 UTC

README

Dependencies

Installation

Install the TARIFF ENGINE SDK package with Composer:

add this to composer.json
"repositories":[
  {
    "type": "vcs",
    "url": "git@bitbucket.org:e-volt/drupal-sdk-for-tariff-engine.git"
  }
],
then run
composer require 'veripark/tariff-engine-sdk'

Usage

use Veripark\Tariff\PriceCalculator;

getPrice

$priceCalculator = new PriceCalculator('https://ev.veripark.co.uk');
$price = $priceCalculator->getPrice([
               'wh'            => 10,                           (int)  wH. Required.
               'start'         => "2020-04-03 01:00:00",        (string) charging session start. Required.
               'end'           => "2020-04-03 03:30:00",        (string) charging session end. Required.
               'cpid'          => "SEC12345678",                (string) charging point unique name. Required.
	       'connector_type'	=> "AC"				(string) connector type: AC|DC allowed. Required
               'rfid'          => "ABC123",                     (string) RFID.
               'switch_code'   => "PAYG",                       (string) switch code.
               'additions'     => 0                             (int) addition cost
        ]);
return
{
    "cost": 205,
    "power_tariff_id": 24,
    "overstayed": false,
    "connector_type": "AC",
    "near_overstay": false,
    "cost_details": {
        "kwh": 200,
        "connection_fee": 5,
        "overstay_fee": 10,
        "minimum_price": 15,
        "maximum_price": 10000,
        "additions": null,
        "price_description": null
    }
}


tariffDescription

$tariffDescription = $priceCalculator->getTariffDescription($chargingPointId, $dateTime, $driverReference, $switchCode);
String $chargePointId       // eg. EVC0005_1. Required
String $dateTime            // eg. 2022-01-01 00:00:00
String $driverReference     // eg. ABC123
String $switchCode          // eg. PAYG
return
String                      // eg. 'Some description ...'

tariffDescriptions

$tariffDescriptions = $priceCalculator->getTariffDescriptions($chargingPointsIds, $dateTime, $driverReference, $switchCode);
Array $chargePointsIds      // eg. ['SEC1234', 'SEC1122']. Required
String $dateTime            // eg. 2022-01-01 00:00:00
String $driverReference     // eg. ABC123
String $switchCode          // eg. PAYG
return
Array
[
    [
        'chargingPointID' => 'SEC1234',
        'description' => 'Some description ...'
    ],
    [
        'chargingPointID' => 'SEC1122',
        'description' => 'Some description ...'
    ],
    
]    

maxStay

$maxStay = $pricaeCalculator->getMaxStay($chargingPointId, $datetime, $connector_type);
String $chargePointId       // eg. EVC0005_1. Required
String $datetime            // eg. 2022-01-01 00:00:00. Required
String $connector_id        // AC or DC allowed. Required
return
Int         / eg. 120