Skip to content

prajwal-aithal/TracksGiving-PHP-Wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README FOR PHP WRAPPER OVER TRACKSGIVING REST APIs.

Authored By Prajwal A N.

-----------------------------------------------------------------------DOCUMENTATION------------------------------------------------------------------------

This document explains how to use the PHP Library for TracksGiving REST APIs.

The src/ folder of the library contains the following 5 files.
1.company donations.php - Contains the Company_Donation class.
2.customer donations.php - Contains the Customer_Donation class.
3.order.php - Contains the Order class.
4.response.php - Contains the Response class.
5.helper_functions.php - Contains the helper functions like extracting xml, validating xml, api caller which do not belong to any class.

To use the library create a new instance of the respective object with right parameters (or fields), and use the respective functions, as explained below.

(i) To create a new Company donation.
    $comp_donation = new CompanyDonation(order id here, order comment here, order submission date here,order due date here,order channel code here,customer email here,token here,campaign key here,donation amount here,project id here);
	$comp_donation_res = $comp_donation->invoke();

(ii) To create a new Customer donation.
	$cust_donation = new CustomerDonation(order id here, order comment here, order payment trx details here, order submission date here, order due date here,order ipaddress here, order channel code here,
										  token here, campaign key here, donation amount here, project id here,donor name here, donor email here, donor genre here, donor pan number here, donor tax payer here,
										  donor addressline here, donor country iso2 here, donor state iso2 here, donor city here, donor zipcode);
	$cust_donation_res = $cust_donation->invoke();
	
$cust_donation_res and $comp_donation_res are the response object generated by invoke() functions of the Customer_Donation and Company_Donation classes.
To know the status ,error, tracking_url of calling the invoke() use - 
echo $cust_donation_res->status;
echo $cust_donation_res->error;
echo $cust_donation_res->tracking_url;
Other details are given in example_implementations.php
	
(iii) To create a new Order (to either cancel or reschedule an existing donation).
	$order = new Order(order id here,token here,order comment here,order due date here);
To cancel or reschedule the Donation with the above order id - 
	$order_res = $order->reschedule();
	echo $order_res->status;
	$order_res = $order->cancel();
	echo $order_res->status;
	
NOTE - Make sure that you do not leave any field blank or just as "" while creating an instance of an object. If left that way, validation errors are going to pop up.
---------------------------------------------------------------------------------------------------------------------------------------------------------

Have a look at the example_implementations.php to know the actual usage of the library.

About

PHP Wrapper over TracksGiving REST APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages