J2T Giftvoucher API

29.99

J2T Gift Voucher API, allow access and modification of vouchers within Magento® web service!
Note that this module only works with J2T Points & Rewards 1.1.1 or greater.

How convenient is it to be able to add or remove vouchers from any application that can use web services and make web services calls. For example, you could have a physical store and would like to update vouchers and/or create one according to requirements, check the amout left in order to use it from the physical store!

J2T Gift Voucher API, allow access and modification of vouchers within Magento® web service!
Note that this module only works with J2T Points & Rewards 1.1.1 or greater. 

How convenient is it to be able to add or remove vouchers from any application that can use web services and make web services calls. For example, you could have a physical store and would like to update vouchers and/or create one according to requirements, check the amout left  in order to use it from the physical store!

Intrunctions

Create an webservice access user and connect to Magento® webservice

$proxy = new SoapClient(‘http://your_magento_url/api/soap/?wsdl’);
$sessionId = $proxy->login(‘api_login’, ‘api_key’);

How to get vouchers

$customerId = 1;
var_dump($proxy->call($sessionId, ‘j2tgiftvoucherapi.info’, array($customerId)));

>> return value will be:

array
0 =>
array
‘id’ => string ‘1’ (length=1)
‘product_id’ => string ‘168’ (length=3)
‘customer_id’ => string ‘1’ (length=1)
‘recipient_name’ => string ‘Xxx X’ (length=5)
‘recipient_email’ => string ‘xxxxxxxxxxxxxx@xxxxxxx.xxx’ (length=26)
‘message’ => string ‘Your gift card’ (length=14)
‘voucher_code’ => string ‘QMHI41QHBV1Z’ (length=12)
‘voucher_date’ => string ‘2014-03-04’ (length=10)
‘voucher_date_end’ => null
‘voucher_amount’ => string ‘0.0000’ (length=6)
‘voucher_base_amount’ => string ‘60.0000’ (length=7)
‘voucher_base_currency’ => string ‘USD’ (length=3)
‘voucher_order_currency’ => string ‘USD’ (length=3)
‘voucher_store_currency’ => string ‘1’ (length=1)
‘voucher_base_rate’ => string ‘1.0000’ (length=6)
‘voucher_order_rate’ => string ‘1.0000’ (length=6)
‘voucher_current_base_amount’ => string ‘60.0000’ (length=7)
‘order_id’ => string ‘6’ (length=1)
‘quote_id’ => string ’35’ (length=2)
‘order_item_id’ => string ‘9’ (length=1)
‘valid’ => string ‘1’ (length=1)
‘send_email’ => null
‘send_post’ => null
‘store_id’ => string ‘0’ (length=1)

How to get customer vouchers

$filter = array(“customer_id” => “1”, “voucher_code” => “IV61KWMXNEA3”);
var_dump($proxy->call($sessionId, ‘j2tgiftvoucherapi.list’, array($filter)));

How to add vouchers

$customer_id = 1;
$recipient_name = “My Friend”;
$recipient_email = “myfriendemail@example.com”;
$message = “Your message”;
$from_name = “Your Friend”;
$voucher_date = “2014-01-01”;
$voucher_date_end = null;
$voucher_base_amount = “30”; //voucher base amount
$voucher_current_base_amount = “30”; //current base amount available
$voucher_code = null;
$product_id = 168;
$valid = 1;
$notify = 1;

$proxy->call($sessionId, ‘j2tgiftvoucherapi.add’, array($customer_id, $recipient_name, $recipient_email, $message, $from_name, $voucher_date, $voucher_date_end, $voucher_base_amount, $voucher_current_base_amount, $voucher_code, $product_id, $valid, $notify));

How to remove vouchers

$customer_id = 1;
$voucher_code = ‘VP2RHDHR4UB0’;
$proxy->call($sessionId, ‘j2tgiftvoucherapi.remove’, array($customer_id, $voucher_code));

How to update vouchers

$proxy->call($sessionId, ‘j2tgiftvoucherapi.update’, array(array(‘id’ => ‘1’, ‘product_id’ => 168, ‘customer_id’ => 1, ‘voucher_code’ => ‘QMHI41QHBV1Z’, ‘voucher_date_end’ => ‘2014-03-23’)));

>> id, product_id and customer_id are required values. It is possible to update all other field. Note that date format is YYYY-MM-DD and if you’d like to regenerate coupon code, you need to set ‘voucher_code’ to null.

files

J2T Gift Voucher API v1.0.0