Skip to content

Commit

Permalink
Merge pull request #16 from highstrike/brand_support
Browse files Browse the repository at this point in the history
Add Brand support
  • Loading branch information
keith-chargeover authored Mar 24, 2022
2 parents c801853 + 9c27b65 commit 98b00aa
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ChargeOverAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected function _request($http_method, $uri, $data = null)
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $http_method);

// Override cURL options
// Override cURL options
if ($this->_http)
{
foreach ($this->_http as $k => $v)
Expand Down Expand Up @@ -429,6 +429,7 @@ protected function _typeClassMap()
ChargeOverAPI_Object::TYPE_QUOTE => 'ChargeOverAPI_Object_Quote',
ChargeOverAPI_Object::TYPE_TRANSACTION => 'ChargeOverAPI_Object_Transaction',
ChargeOverAPI_Object::TYPE_ACH => 'ChargeOverAPI_Object_Ach',
ChargeOverAPI_Object::TYPE_BRAND => 'ChargeOverAPI_Object_Brand',
ChargeOverAPI_Object::TYPE_USAGE => 'ChargeOverAPI_Object_Usage',
ChargeOverAPI_Object::TYPE_ITEM => 'ChargeOverAPI_Object_Item',
ChargeOverAPI_Object::TYPE_ITEMCATEGORY => 'ChargeOverAPI_Object_ItemCategory',
Expand Down
1 change: 1 addition & 0 deletions ChargeOverAPI/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ChargeOverAPI_Object
const TYPE_CREDITCARD = 'creditcard';
const TYPE_TRANSACTION = 'transaction';
const TYPE_ACH = 'ach';
const TYPE_BRAND = 'brand';
const TYPE_USAGE = 'usage';
const TYPE_NOTE = 'note';
const TYPE_COUNTRY = 'country';
Expand Down
6 changes: 6 additions & 0 deletions ChargeOverAPI/Object/Brand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

class ChargeOverAPI_Object_Brand extends ChargeOverAPI_Object
{

}
31 changes: 31 additions & 0 deletions docs/example_get_brand_by_id.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

header('Content-Type: text/plain');

require '../ChargeOverAPI.php';
require 'config.php';

$API = new ChargeOverAPI($url, $authmode, $username, $password);

//Find a brand by the ChargeOver brand ID
$resp = $API->findById('brand', '4');


/*
print("\n\n\n\n");
print($API->lastRequest());
print("\n\n\n\n");
print($API->lastResponse());
print("\n\n\n\n");
*/

if (!$API->isError($resp))
{
$brand = $resp->response;
print('SUCCESS! got back brand: ' . $brand->name);
}
else
{
print('There was an error looking up the brand!' . "\n");
}

0 comments on commit 98b00aa

Please sign in to comment.