lizhen_gitee пре 1 година
родитељ
комит
252f4cfdae

+ 26 - 2
application/api/controller/Demo.php

@@ -3,7 +3,7 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
-require_once '../vendor/autoload.php';
+
 /**
  * 示例接口
  */
@@ -71,7 +71,31 @@ class Demo extends Api
      */
     public function test1()
     {
-        $this->success('返回成功', ['action' => 'test1']);
+        $curl = curl_init();
+
+        curl_setopt_array($curl, [
+            CURLOPT_URL => "https://api.sandbox.hit-pay.com/v1/orders",
+            CURLOPT_RETURNTRANSFER => true,
+            CURLOPT_ENCODING => "",
+            CURLOPT_MAXREDIRS => 10,
+            CURLOPT_TIMEOUT => 30,
+            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+            CURLOPT_CUSTOMREQUEST => "GET",
+            CURLOPT_HTTPHEADER => [
+                "X-BUSINESS-API-KEY: <096a06e94fb1e0a8b015485bb76ef5dd63c167679297e07331a687327bd8b12e>"
+            ],
+        ]);
+
+        $response = curl_exec($curl);
+        $err = curl_error($curl);
+
+        curl_close($curl);
+
+        if ($err) {
+            echo "cURL Error #:" . $err;
+        } else {
+            echo $response;
+        }
     }
 
     /**

+ 222 - 0
extend/hitpay/Client.php

@@ -0,0 +1,222 @@
+<?php
+
+namespace HitPay;
+
+use HitPay\Request\CreatePayment;
+use HitPay\Response\CreatePayment as CreatePaymentResponse;
+use HitPay\Response\DeletePaymentRequest;
+use HitPay\Response\PaymentStatus;
+use HitPay\Response\Refund;
+use HitPay\Request\CreateSubscriptionPlan;
+use HitPay\Response\CreateSubscriptionPlan as CreateSubscriptionPlanResponse;
+use HitPay\Request\RecurringBilling;
+use HitPay\Response\RecurringBilling as RecurringBillingResponse;
+use HitPay\Request\UpdateRecurringBilling;
+use HitPay\Request\ChargeSavedCard;
+use HitPay\Response\ChargeSavedCard as ChargeSavedCardResponse;
+
+/**
+ * Class Client
+ * @package HitPay
+ */
+class Client extends Request
+{
+    const API_ENDPOINT = 'https://api.hit-pay.com/v1';
+
+    const SANDBOX_API_ENDPOINT = 'https://api.sandbox.hit-pay.com/v1';
+
+    const TYPE_CONTENT = 'application/x-www-form-urlencoded';
+
+    protected $privateApiKey = '';
+
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#create-payment-request
+     *
+     * @param CreatePayment $request
+     * @return CreatePaymentResponse
+     * @throws \Exception
+     */
+    public function createPayment(CreatePayment $request)
+    {
+        $result = $this->request('POST', '/payment-requests', (array)$request);
+
+        return new CreatePaymentResponse($result);
+    }
+
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#get-payment-status
+     *
+     * @param $id
+     * @return PaymentStatus
+     * @throws \Exception
+     */
+    public function getPaymentStatus($id)
+    {
+        $result = $this->request('GET', '/payment-requests/' . $id);
+
+        return new PaymentStatus($result);
+    }
+
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#delete-payment-request
+     *
+     * @param $id
+     * @return PaymentStatus
+     * @throws \Exception
+     */
+    public function deletePaymentRequest($id)
+    {
+        $result = $this->request('DELETE', '/payment-requests/' . $id);
+
+        return new DeletePaymentRequest($result);
+    }
+
+    /**
+     * @param $secret
+     * @param array $args
+     * @return string
+     */
+    public static function generateSignatureArray($secret, array $args)
+    {
+        $hmacSource = [];
+        foreach ($args as $key => $val) {
+            $hmacSource[$key] = "{$key}{$val}";
+        }
+        ksort($hmacSource);
+        $sig = implode("", array_values($hmacSource));
+        return hash_hmac('sha256', $sig, $secret);
+    }
+    
+    /**
+     * https://hit-pay.com/docs.html?php#refund
+     *
+     * @params $payment_id, $amount
+     * @return Refund Response
+     * @throws \Exception
+     */
+    public function refund($payment_id, $amount)
+    {
+        $result = $this->request('POST', '/refund', array('payment_id' => $payment_id, 'amount' => $amount));
+
+        return new Refund($result);
+    }
+    
+    /**
+     * https://hit-pay.com/docs.html?shell#create-payment-request
+     *
+     * @param CreateSubscriptionPlan $request
+     * @return CreateSubscriptionPlanResponse
+     * @throws \Exception
+     */
+    public function createSubscriptionPlan(CreateSubscriptionPlan $request)
+    {
+        $result = $this->request('POST', '/subscription-plan', (array)$request);
+
+        return new CreateSubscriptionPlanResponse($result);
+    }
+    
+    /**
+     * https://hit-pay.com/docs.html?shell#recurring-billing
+     *
+     * @param RecurringBilling $request
+     * @return RecurringBillingResponse
+     * @throws \Exception
+     */
+    public function recurringBilling(RecurringBilling $request)
+    {
+        $finalRequestParams = [];
+        $requestParams = (array)$request;
+        foreach ($requestParams as $key => $val) {
+            if (!empty($val)) {
+                $finalRequestParams[$key] = $val;
+            }
+        }
+        $result = $this->request('POST', '/recurring-billing', $finalRequestParams);
+
+        return new RecurringBillingResponse($result);
+    }
+    
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#recurring-billing/{recurring-billing-id}
+     *
+     * @param $id
+     * @return RecurringBillingResponse
+     * @throws \Exception
+     */
+    public function getRecurringBillingStatus($id)
+    {
+        $result = $this->request('GET', '/recurring-billing/' . $id);
+
+        return new RecurringBillingResponse($result);
+    }
+    
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#recurring-billing/{recurring-billing-id}
+     *
+     * @param $id
+     * @return RecurringBillingResponse
+     * @throws \Exception
+     */
+    public function cancelSubscription($id)
+    {
+        $result = $this->request('DELETE', '/recurring-billing/' . $id);
+
+        return new RecurringBillingResponse($result);
+    }
+    
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#subscription-plan/{plan_id}
+     *
+     * @param $id
+     * @return SubscriptionPlanResponse
+     * @throws \Exception
+     */
+    public function getSubscriptionPlanDetails($id)
+    {
+        $result = $this->request('GET', '/subscription-plan/' . $id);
+
+        return new CreateSubscriptionPlanResponse($result);
+    }
+    
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#subscription-plan/{plan_id}
+     *
+     * @param $id
+     * @return SubscriptionPlanResponse
+     * @throws \Exception
+     */
+    public function updateSubscriptionPlan($id, CreateSubscriptionPlan $request)
+    {
+        $result = $this->request('PUT', '/subscription-plan/' . $id, (array)$request);
+
+        return new CreateSubscriptionPlanResponse($result);
+    }
+    
+    /**
+     * https://staging.hit-pay.com/docs.html?shell#recurring-billing/{recurring-billing-id}
+     *
+     * @param $id
+     * @return RecurringBillingResponse
+     * @throws \Exception
+     */
+    public function updateRecurringBilling($id, UpdateRecurringBilling $request)
+    {
+        $result = $this->request('PUT', '/recurring-billing/' . $id, (array)$request);
+
+        return new RecurringBillingResponse($result);
+    }
+    
+        /**
+     * https://staging.hit-pay.com/docs.html?shell#recurring-billing/{recurring-billing-id}
+     *
+     * @param $id
+     * @return ChargeSavedCardResponse
+     * @throws \Exception
+     */
+    public function chargeSavedCard($id, ChargeSavedCard $request)
+    {
+        $result = $this->request('POST', '/recurring-billing/' . $id, (array)$request);
+
+        return new ChargeSavedCardResponse($result);
+    }
+}

+ 262 - 0
extend/hitpay/CurlEmulator.php

@@ -0,0 +1,262 @@
+<?php
+if (!extension_loaded('curl')) {
+    // The curl option constants
+    define ('CURLOPT_RETURNTRANSFER2', 19913);
+    define ('CURLOPT_SSL_VERIFYPEER2', 64);
+    define ('CURLOPT_SSL_VERIFYHOST2', 81);
+    define ('CURLOPT_USERAGENT2', 10018);
+    define ('CURLOPT_HEADER2', 42);
+    define ('CURLOPT_CUSTOMREQUEST2', 10036);
+    define ('CURLOPT_POST2', 47);
+    define ('CURLOPT_POSTFIELDS2', 10015);
+    define ('CURLOPT_HTTPHEADER2', 10023);
+    define ('CURLOPT_URL2', 10002);
+    define ('CURLOPT_HTTPGET2', 80); // this could be a good idea to handle params as array
+    define ('CURLOPT_CONNECTTIMEOUT2', 78);
+    define ('CURLOPT_TIMEOUT2', 13);
+    define ('CURLOPT_CAINFO2', 10065);
+    define ('CURLOPT_SSLVERSION2', 32);
+    define ('CURLOPT_FOLLOWLOCATION2', 52);
+    define ('CURLOPT_FORBID_REUSE2', 75);
+    define ('CURLOPT_HTTP_VERSION2', 84);
+    define ('CURLOPT_MAXREDIRS2', 68);
+    define ('CURLOPT_ENCODING2', 10102);
+
+    // curl info constants
+    define ('CURLINFO_HEADER_SIZE2', 2097163);
+    define ('CURLINFO_HTTP_CODE2', 2097154);
+    define ('CURLINFO_HEADER_OUT2', 2); // This seems to be an option?
+    define ('CURLINFO_TOTAL_TIME2', 3145731);
+
+    define ('CURLE_SSL_CACERT2', 60);
+    define ('CURLE_SSL_PEER_CERTIFICATE2', 51);
+    define ('CURLE_SSL_CACERT_BADFILE2', 77);
+
+    define ('CURLE_COULDNT_CONNECT2', 7);
+    define ('CURLE_OPERATION_TIMEOUTED2', 28);
+    define ('CURLE_COULDNT_RESOLVE_HOST2', 6);
+
+    class CurlEmulator
+    {
+        // Storing the result in here
+        private $result;
+
+        // The headers of the result will be stored here
+        private $responseHeader;
+
+        // url for request
+        private $url;
+
+        // options
+        private $options = [];
+
+        public function __construct($url)
+        {
+            $this->url = $url;
+        }
+
+        public function setOpt($option, $value)
+        {
+            $this->options[$option] = $value;
+        }
+
+        public function getInfo($opt = 0)
+        {
+            if (!$this->result) {
+                $this->fetchResult();
+            }
+
+            $responseHeaderSize = 0;
+            foreach ($this->responseHeader as $header)
+                $responseHeaderSize += (strlen($header) + 2); // The one is for each newline
+
+            $httpCode = 200;
+            if (preg_match('#HTTP/\d+\.\d+ (\d+)#', $this->responseHeader[0], $matches))
+                $httpCode = intval($matches[1]);
+
+            // opt
+            if ($opt == CURLINFO_HEADER_SIZE2)
+                return $responseHeaderSize;
+
+            if ($opt == CURLINFO_HTTP_CODE2)
+                return $httpCode;
+
+            return [
+                "url" => $this->url,
+                "content_type" => "",
+                "http_code" => $httpCode,
+                "header_size" => $responseHeaderSize,
+                "request_size" => 0,
+                "filetime" => 0,
+                "ssl_verify_result" => null,
+                "redirect_count" => 0,
+                "total_time" => 0,
+                "namelookup_time" => 0,
+                "connect_time" => 0,
+                "pretransfer_time" => 0,
+                "size_upload" => 0,
+                "size_download" => 0,
+                "speed_download" => 0,
+                "speed_upload" => 0,
+                "download_content_length" => 0,
+                "upload_content_length" => 0,
+                "starttransfer_time" => 0,
+                "redirect_time" => 0,
+                "certinfo" => 0,
+                "request_header" => 0
+            ];
+        }
+
+        public function exec()
+        {
+            $this->fetchResult();
+
+            $fullResult = $this->result;
+
+            if ($this->getValue(CURLOPT_HEADER2, false)) {
+                $headers = implode("\r\n", $this->responseHeader);
+                $fullResult = $headers . "\r\n" . $this->result;
+            }
+
+            if ($this->getValue(CURLOPT_RETURNTRANSFER2, false) == false) {
+                print $fullResult;
+            } else {
+                return $fullResult;
+            }
+        }
+
+        private function fetchResult()
+        {
+            // Create the context for this request based on the curl parameters
+
+            // Determine the method
+            if (!$this->getValue(CURLOPT_CUSTOMREQUEST2, false) && $this->getValue(CURLOPT_POST2, false)) {
+                $method = 'POST';
+            } else {
+                $method = $this->getValue(CURLOPT_CUSTOMREQUEST2, 'GET');
+            }
+
+            // Add the post header if type is post and it has not been added
+            if ($method == 'POST') {
+                if (is_array($this->getValue(CURLOPT_HTTPHEADER2))) {
+                    $found = false;
+                    foreach ($this->getValue(CURLOPT_HTTPHEADER2, array()) as $header) {
+                        if (strtolower($header) == strtolower('Content-type: application/x-www-form-urlencoded')) {
+                            $found = true;
+                        }
+                    }
+
+                    // add post header if not found
+                    if (!$found) {
+                        $headers = $this->getValue(CURLOPT_HTTPHEADER2, array());
+                        $headers[] = 'Content-type: application/x-www-form-urlencoded';
+                        $this->setOpt(CURLOPT_HTTPHEADER2, $headers);
+                    }
+                }
+            }
+
+            // Determine the content which can be an array or a string
+            if (is_array($this->getValue(CURLOPT_POSTFIELDS2))) {
+                $content = http_build_query($this->getValue(CURLOPT_POSTFIELDS2, array()));
+            } else {
+                $content = $this->getValue(CURLOPT_POSTFIELDS2, "");
+            }
+
+            // get timeout
+            $timeout = $this->getValue(CURLOPT_TIMEOUT2, 60);
+            $connectTimeout = $this->getValue(CURLOPT_CONNECTTIMEOUT2, 30);
+
+            // take bigger timeout
+            if ($connectTimeout > $timeout)
+                $timeout = $connectTimeout;
+
+            $headers = $this->getValue(CURLOPT_HTTPHEADER2, "");
+            if (is_array($headers)) {
+                $headers = join("\r\n", $headers);
+            }
+
+            // 'http' instead of $parsedUrl['scheme']; https doest work atm
+            $options = array(
+                'http' => array(
+                    "timeout" => $timeout,
+                    "ignore_errors" => true,
+                    'method' => $method,
+                    'header' => $headers,
+                    'content' => $content
+                )
+            );
+
+            $options["http"]["follow_location"] = $this->getValue(CURLOPT_FOLLOWLOCATION2, 1);
+
+            // get url from options
+            if ($this->getValue(CURLOPT_URL2, false))
+                $this->url = $this->getValue(CURLOPT_URL2);
+
+            $context = stream_context_create($options);
+            $this->result = file_get_contents($this->url, false, $context);
+
+            $this->responseHeader = $http_response_header;
+        }
+
+        private function getValue($value, $default = null)
+        {
+            if (isset($this->options[$value]) && $this->options[$value]) {
+                return $this->options[$value];
+            }
+            return $default;
+        }
+
+        public function errNo()
+        {
+            return 0;
+        }
+
+        public function error()
+        {
+            return "";
+        }
+
+        public function close()
+        {
+
+        }
+    }
+
+    function curl_init2($url = null)
+    {
+        return new CurlEmulator($url);
+    }
+
+    function curl_setopt2($ch, $option, $value)
+    {
+        $ch->setOpt($option, $value);
+    }
+
+    function curl_exec2($ch)
+    {
+        return $ch->exec();
+    }
+
+    function curl_getinfo2($ch, $option = 0)
+    {
+        return $ch->getInfo($option);
+    }
+
+    function curl_errno2($ch) {
+        return $ch->errNo();
+    }
+
+    function curl_error2($ch) {
+        return $ch->error();
+    }
+
+    function curl_close2($ch) {
+        return $ch->close();
+    }
+
+    function curl_setopt_array2($ch, $options) {
+        foreach ($options as $option => $value) {
+            curl_setopt2($ch, $option, $value);
+        }
+    }
+}

+ 158 - 0
extend/hitpay/Request.php

@@ -0,0 +1,158 @@
+<?php
+
+namespace HitPay;
+
+/**
+ * Class Request
+ * @package HitPay
+ */
+class Request
+{
+    const API_ENDPOINT = '';
+
+    const SANDBOX_API_ENDPOINT = '';
+
+    const TYPE_CONTENT = '';
+
+    /**
+     * @var string
+     */
+    protected $privateApiKey = '';
+
+    /**
+     * @var bool
+     */
+    protected $isLive = false;
+
+    private $ch;
+
+    /**
+     * List of errors - https://staging.hit-pay.com/docs.html?shell#errors
+     *
+     * @var string[]
+     */
+    protected $errors = array(
+        400 => 'Bad Request -- Your request is invalid.',
+        401 => 'Unauthorized -- Your API key is wrong.',
+        404 => 'Not Found -- The payment request could not be found.',
+        500 => 'Internal Server Error -- We had a problem with our server. Try again later.',
+    );
+
+    /**
+     * Request constructor.
+     * @param $privateApiKey
+     * @param bool $live
+     * @throws \Exception
+     */
+    public function __construct($privateApiKey, $live = false)
+    {
+        if (!extension_loaded('curl')) {
+            $this->ch = curl_init2();
+        } else {
+            $this->ch = curl_init();
+        }
+
+        $this->privateApiKey = $privateApiKey;
+        $this->isLive = $live;
+    }
+
+    /**
+     * @param $type PUT, DELETE, GET, POST
+     * @param $path
+     * @param array $request
+     * @return bool
+     * @throws \Exception
+     */
+    protected function request($type, $path, $request = array())
+    {
+        $endpoint = $this->isLive ? static::API_ENDPOINT : static::SANDBOX_API_ENDPOINT;
+        if (!extension_loaded('curl')) {
+            curl_setopt2($this->ch, CURLOPT_URL2, $endpoint . $path);
+            curl_setopt2($this->ch, CURLOPT_HEADER2, false);
+            curl_setopt2($this->ch, CURLOPT_SSL_VERIFYPEER2, false); 
+            curl_setopt2($this->ch, CURLOPT_RETURNTRANSFER2, true);
+            curl_setopt2($this->ch, CURLOPT_CUSTOMREQUEST2, $type);
+
+            if (!empty($request)) {
+                $request = http_build_query($request);
+                curl_setopt2($this->ch, CURLOPT_POSTFIELDS2, $request);
+            }
+
+            curl_setopt2($this->ch, CURLOPT_HTTPHEADER2, $this->getHeaders());
+
+            $result = curl_exec2($this->ch);
+        } else {
+            curl_setopt($this->ch, CURLOPT_URL, $endpoint . $path);
+            curl_setopt($this->ch, CURLOPT_HEADER, false);
+            curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); 
+            curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
+            curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $type);
+
+            if (!empty($request)) {
+                $request = http_build_query($request);
+                curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request);
+            }
+            curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->getHeaders());
+
+            $result = curl_exec($this->ch);
+        }
+        $result = !empty($result) ? json_decode($result) : null;
+
+        $this->checkError($result);
+
+        return $result;
+    }
+
+    /**
+     * @param null $response
+     * @return void
+     * @throws \Exception
+     */
+    protected function checkError($response = null)
+    {
+        if (!extension_loaded('curl')) {
+            $error = curl_error2($this->ch);
+            $httpCode = curl_getinfo2($this->ch, CURLINFO_HTTP_CODE2);
+        } else {
+            $error = curl_error($this->ch);
+            $httpCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
+        }
+        
+        if (!empty($error)) {
+            throw new \Exception($error);
+        } elseif (isset($response->detail)) {
+            throw new \Exception($response->detail);
+        } elseif (isset($response->message)) {
+            throw new \Exception($response->message.'.');
+        } elseif ($httpCode != 200 && $httpCode != 201) {
+            $message = isset($this->errors[$httpCode])
+                ? $this->errors[$httpCode]
+                : 'Error message does not exists.';
+            throw new \Exception($message, $httpCode);
+        }
+    }
+
+    /**
+     * @return string[]
+     */
+    protected function getHeaders()
+    {
+        return [
+            'Content-Type: ' . static::TYPE_CONTENT,
+            'X-BUSINESS-API-KEY: ' . $this->privateApiKey,
+            'X-Requested-With: XMLHttpRequest'
+        ];
+    }
+
+    /**
+     *
+     */
+    public function __destruct()
+    {
+        if (!extension_loaded('curl')) {
+            curl_close2($this->ch);
+        } else {
+            curl_close($this->ch);
+        }
+    }
+}

+ 63 - 0
extend/hitpay/Request/ChargeSavedCard.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace HitPay\Request;
+
+/**
+ * Class ChargeSavedCard - https://staging.hit-pay.com/docs.html?shell#payment-requests
+ *
+ * @package HitPay\Request
+ */
+class ChargeSavedCard
+{
+    /**
+     * Amount related to the payment
+     *
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * Currency related to the payment
+     *
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @param float $amount
+     * @return CreateSubscriptionPlan
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return CreateSubscriptionPlan
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+}

+ 349 - 0
extend/hitpay/Request/CreatePayment.php

@@ -0,0 +1,349 @@
+<?php
+
+namespace HitPay\Request;
+
+/**
+ * Class CreatePayment - https://staging.hit-pay.com/docs.html?shell#payment-requests
+ *
+ * @package HitPay\Request
+ */
+class CreatePayment
+{
+    /**
+     * Amount related to the payment
+     *
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * Currency related to the payment
+     *
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * Choice of payment methods you want to offer the customer
+     *
+     * @var array
+     */
+    public $payment_methods;
+
+    /**
+     * Buyer’s email
+     *
+     * @var string
+     */
+    public $email;
+
+    /**
+     * Purpose of the Payment request FIFA 16
+     *
+     * @var
+     */
+    public $purpose;
+
+    /**
+     * Buyer’s name
+     *
+     * @var string
+     */
+    public $name;
+
+    /**
+     * Buyer’s phone number
+     *
+     * @var int
+     */
+    public $phone;
+
+    /**
+     * Arbitrary reference number that you can map to your internal reference number.
+     * This value cannot be edited by the customer
+     *
+     * @var string
+     */
+    public $reference_number;
+
+    /**
+     * URL where we redirect the user after a payment.
+     * Query arguments payment_request_id and status are sent along
+     *
+     * @var string
+     */
+    public $redirect_url;
+
+    /**
+     * URL where our server do POST request after a payment If done
+     *
+     * @var string
+     */
+    public $webhook;
+
+    /**
+     * If set is true, multiple payments can be paid on a payment request link. Default value is false
+     *
+     * @var bool
+     */
+    public $allow_repeated_payments;
+
+    /**
+     * Time after which the payment link will be expired.Applicable for repeated payments. Default is Null
+     *
+     * @var null
+     */
+    public $expiry_date;
+
+    /**
+     * @var string
+     */
+    public $channel;
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @return array
+     */
+    public function getPaymentMethods()
+    {
+        return $this->payment_methods;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEmail()
+    {
+        return $this->email;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPurpose()
+    {
+        return $this->purpose;
+    }
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @return int
+     */
+    public function getPhone()
+    {
+        return $this->phone;
+    }
+
+    /**
+     * @return string
+     */
+    public function getReferenceNumber()
+    {
+        return $this->reference_number;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRedirectUrl()
+    {
+        return $this->redirect_url;
+    }
+
+    /**
+     * @return string
+     */
+    public function getWebhook()
+    {
+        return $this->webhook;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isAllowRepeatedPayments()
+    {
+        return $this->allow_repeated_payments;
+    }
+
+    /**
+     * @return null
+     */
+    public function getExpiryDate()
+    {
+        return $this->expiry_date;
+    }
+
+    /**
+     * @param float $amount
+     * @return CreatePayment
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return CreatePayment
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param array $payment_methods
+     * @return CreatePayment
+     */
+    public function setPaymentMethods($payment_methods)
+    {
+        $this->payment_methods = $payment_methods;
+
+        return $this;
+    }
+
+    /**
+     * @param string $email
+     * @return CreatePayment
+     */
+    public function setEmail($email)
+    {
+        $this->email = $email;
+
+        return $this;
+    }
+
+    /**
+     * @param mixed $purpose
+     * @return CreatePayment
+     */
+    public function setPurpose($purpose)
+    {
+        $this->purpose = $purpose;
+
+        return $this;
+    }
+
+    /**
+     * @param string $name
+     * @return CreatePayment
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @param int $phone
+     * @return CreatePayment
+     */
+    public function setPhone($phone)
+    {
+        $this->phone = $phone;
+
+        return $this;
+    }
+
+    /**
+     * @param string $reference_number
+     * @return CreatePayment
+     */
+    public function setReferenceNumber($reference_number)
+    {
+        $this->reference_number = $reference_number;
+
+        return $this;
+    }
+
+    /**
+     * @param string $redirect_url
+     * @return CreatePayment
+     */
+    public function setRedirectUrl($redirect_url)
+    {
+        $this->redirect_url = $redirect_url;
+
+        return $this;
+    }
+
+    /**
+     * @param string $webhook
+     * @return CreatePayment
+     */
+    public function setWebhook($webhook)
+    {
+        $this->webhook = $webhook;
+
+        return $this;
+    }
+
+    /**
+     * @param bool $allow_repeated_payments
+     * @return CreatePayment
+     */
+    public function setAllowRepeatedPayments($allow_repeated_payments)
+    {
+        $this->allow_repeated_payments = $allow_repeated_payments;
+
+        return $this;
+    }
+
+    /**
+     * @param null $expiry_date
+     * @return CreatePayment
+     */
+    public function setExpiryDate($expiry_date)
+    {
+        $this->expiry_date = $expiry_date;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getChannel()
+    {
+        return $this->channel;
+    }
+
+    /**
+     * @param string $channel
+     * @return CreatePayment
+     */
+    public function setChannel($channel)
+    {
+        $this->channel = $channel;
+
+        return $this;
+    }
+}

+ 195 - 0
extend/hitpay/Request/CreateSubscriptionPlan.php

@@ -0,0 +1,195 @@
+<?php
+
+namespace HitPay\Request;
+
+/**
+ * Class CreateSubscriptionPlan - https://staging.hit-pay.com/docs.html?shell#payment-requests
+ *
+ * @package HitPay\Request
+ */
+class CreateSubscriptionPlan
+{
+    /**
+     * Amount related to the payment
+     *
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * Currency related to the payment
+     *
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * Plan name
+     *
+     * @var string
+     */
+    public $name;
+
+    /**
+     * Billing frequency (weekly / monthly / yearly /custom)
+     *
+     * @var string
+     */
+    public $cycle;
+    
+    /**
+     * This field is only applicable when cycle = custom] It's the number of times the cycle will repeat.
+     *
+     * @var string
+     */
+    public $cycle_repeat;
+    
+    /**
+     * This field is only applicable when cycle = custom] It's the frequency of the cycle [day / week / month / year
+     *
+     * @var string
+     */
+    public $cycle_frequency;
+
+    /**
+     * Arbitrary reference number that you can map to your internal reference number.
+     * This value cannot be edited by the customer
+     *
+     * @var string
+     */
+    public $reference;
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCycle()
+    {
+        return $this->cycle;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleRepeat()
+    {
+        return $this->cycle_repeat;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleFrequency()
+    {
+        return $this->cycle_frequency;
+    }
+
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+    
+    /**
+     * @param float $amount
+     * @return CreateSubscriptionPlan
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return CreateSubscriptionPlan
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param string $name
+     * @return CreateSubscriptionPlan
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @param sring $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycle($cycle)
+    {
+        $this->cycle = $cycle;
+
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycleRepeat($cycle_repeat)
+    {
+        $this->cycle_repeat = $cycle_repeat;
+        
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycleFrequency($cycle_frequency)
+    {
+        $this->cycle_frequency = $cycle_frequency;
+        
+        return $this;
+    }
+
+    /**
+     * @param string $reference
+     * @return CreateSubscriptionPlan
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+
+        return $this;
+    }
+}

+ 304 - 0
extend/hitpay/Request/RecurringBilling.php

@@ -0,0 +1,304 @@
+<?php
+
+namespace HitPay\Request;
+
+/**
+ * Class RecurringBilling - https://staging.hit-pay.com/docs.html?shell#recurring-billing
+ *
+ * @package HitPay\Request
+ */
+class RecurringBilling
+{
+    /**
+     * Plan Id
+     *
+     * @var string
+     */
+    public $plan_id;
+    
+    /**
+     * Customer email
+     *
+     * @var string
+     */
+    public $customer_email;
+    
+    /**
+     * Customer name
+     *
+     * @var string
+     */
+    public $customer_name;
+    
+    /**
+     * Billing start date (YYYY-MM-DD) in SGT
+     *
+     * @var null
+     */
+    public $start_date;
+    
+    /**
+     * URL where hitpay redirects the user after the users enters the card details 
+     * and the subscription is active. Query arguments reference
+     * (subscription id) and  status are sent along
+     *
+     * @var string
+     */
+    public $redirect_url;
+    
+    /**
+     * Arbitrary reference number that you can map to your internal reference number.
+     * This value cannot be edited by the customer
+     *
+     * @var string
+     */
+    public $reference;
+    
+    /**
+     * Amount related to the payment
+     *
+     * @var float
+     */
+    public $amount;
+    
+    /**
+     * Optional URL value to which hitpay will send a POST request 
+     * when there is a new charge or if there is an error charging the card
+     *
+     * @var string
+     */
+    public $webhook;
+
+    /**
+     * Set the value “true” if you wish to save the card. More details in “Save Card” section 
+     *
+     * @var string
+     */
+    public $save_card;
+
+
+    /**
+     * Number of times to charge the card
+     *
+     * @var string
+     */
+    public $times_to_be_charge;
+
+    /**
+     * Hitpay to send email receipts to the customer. Default value is false
+     *
+     * @var string
+     */
+    public $send_email;
+
+
+    /**
+     * @param float $plan_id
+     * @return RecurringBIlling
+     */
+    public function setPlanId($plan_id)
+    {
+        $this->plan_id = $plan_id;
+
+        return $this;
+    }
+
+
+    /**
+     * @return string
+     */
+    public function getPlanId()
+    {
+        return $this->plan_id;
+    }
+    
+    /**
+     * @param float $customer_email
+     * @return RecurringBIlling
+     */
+    public function setCustomerEmail($customer_email)
+    {
+        $this->customer_email = $customer_email;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCustomerEmail()
+    {
+        return $this->customer_email;
+    }
+
+    /**
+     * @param float $amount
+     * @return RecurringBIlling
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+    
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @param string $start_date
+     * @return RecurringBIlling
+     */
+    public function setStartDate($start_date)
+    {
+        $this->start_date = $start_date;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getStartDate()
+    {
+        return $this->start_date;
+    }
+
+    /**
+     * @param string $customer_name
+     * @return RecurringBIlling
+     */
+    public function setCustomerName($customer_name)
+    {
+        $this->customer_name = $customer_name;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCustomerName()
+    {
+        return $this->customer_name;
+    }
+    
+    /**
+     * @param string $redirect_url
+     * @return RecurringBIlling
+     */
+    public function setRedirectUrl($redirect_url)
+    {
+        $this->redirect_url = $redirect_url;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getRedirectUrl()
+    {
+        return $this->redirect_url;
+    }
+    
+    /**
+     * @param string $webhook
+     * @return RecurringBIlling
+     */
+    public function setWebhook($webhook)
+    {
+        $this->webhook = $webhook;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getWebhook()
+    {
+        return $this->webhook;
+    }
+    
+    /**
+     * @param sring $save_card
+     * @return RecurringBIlling
+     */
+    public function setSaveCard($save_card)
+    {
+        $this->save_card = $save_card;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSaveCard()
+    {
+        return $this->save_card;
+    }
+    
+    /**
+     * @param sring $times_to_be_charge
+     * @return RecurringBIlling
+     */
+    public function setTimesToBeCharge($times_to_be_charge)
+    {
+        $this->times_to_be_charge = $times_to_be_charge;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getTimesToBeCharge()
+    {
+        return $this->times_to_be_charge;
+    }
+
+    /**
+     * @param sring $send_email
+     * @return RecurringBIlling
+     */
+    public function setSendEmail($send_email)
+    {
+        $this->send_email = $send_email;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSendEmail()
+    {
+        return $this->send_email;
+    }
+
+    /**
+     * @param string $reference
+     * @return RecurringBIlling
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+}

+ 368 - 0
extend/hitpay/Request/UpdateRecurringBilling.php

@@ -0,0 +1,368 @@
+<?php
+
+namespace HitPay\Request;
+
+/**
+ * Class RecurringBilling - https://staging.hit-pay.com/docs.html?shell#recurring-billing
+ *
+ * @package HitPay\Request
+ */
+class UpdateRecurringBilling
+{
+    /**
+     * Plan Id
+     *
+     * @var string
+     */
+    public $plan_id;
+    
+    /**
+     * Customer email
+     *
+     * @var string
+     */
+    public $customer_email;
+    
+    /**
+     * Customer name
+     *
+     * @var string
+     */
+    public $customer_name;
+    
+    /**
+     * Billing start date (YYYY-MM-DD) in SGT
+     *
+     * @var null
+     */
+    public $start_date;
+    
+    /**
+     * URL where hitpay redirects the user after the users enters the card details 
+     * and the subscription is active. Query arguments reference
+     * (subscription id) and  status are sent along
+     *
+     * @var string
+     */
+    public $redirect_url;
+    
+    /**
+     * Arbitrary reference number that you can map to your internal reference number.
+     * This value cannot be edited by the customer
+     *
+     * @var string
+     */
+    public $reference;
+    
+    /**
+     * Amount related to the payment
+     *
+     * @var float
+     */
+    public $amount;
+    
+    /**
+     * Optional URL value to which hitpay will send a POST request 
+     * when there is a new charge or if there is an error charging the card
+     *
+     * @var string
+     */
+    public $webhook;
+
+    /**
+     * Hitpay to send email receipts to the customer. Default value is false
+     *
+     * @var string
+     */
+    public $send_email;
+    
+    /**
+     * Billing frequency (weekly / monthly / yearly /custom)
+     *
+     * @var string
+     */
+    public $cycle;
+    
+    /**
+     * This field is only applicable when cycle = custom] It's the number of times the cycle will repeat.
+     *
+     * @var string
+     */
+    public $cycle_repeat;
+    
+    /**
+     * This field is only applicable when cycle = custom] It's the frequency of the cycle [day / week / month / year
+     *
+     * @var string
+     */
+    public $cycle_frequency;
+
+
+    /**
+     * @param float $plan_id
+     * @return UpdateRecurringBilling
+     */
+    public function setPlanId($plan_id)
+    {
+        $this->plan_id = $plan_id;
+
+        return $this;
+    }
+
+
+    /**
+     * @return string
+     */
+    public function getPlanId()
+    {
+        return $this->plan_id;
+    }
+    
+    /**
+     * @param float $customer_email
+     * @return UpdateRecurringBilling
+     */
+    public function setCustomerEmail($customer_email)
+    {
+        $this->customer_email = $customer_email;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCustomerEmail()
+    {
+        return $this->customer_email;
+    }
+
+    /**
+     * @param float $amount
+     * @return UpdateRecurringBilling
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+    
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @param string $start_date
+     * @return UpdateRecurringBilling
+     */
+    public function setStartDate($start_date)
+    {
+        $this->start_date = $start_date;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getStartDate()
+    {
+        return $this->start_date;
+    }
+
+    /**
+     * @param string $customer_name
+     * @return UpdateRecurringBilling
+     */
+    public function setCustomerName($customer_name)
+    {
+        $this->customer_name = $customer_name;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCustomerName()
+    {
+        return $this->customer_name;
+    }
+    
+    /**
+     * @param string $redirect_url
+     * @return UpdateRecurringBilling
+     */
+    public function setRedirectUrl($redirect_url)
+    {
+        $this->redirect_url = $redirect_url;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getRedirectUrl()
+    {
+        return $this->redirect_url;
+    }
+    
+    /**
+     * @param string $webhook
+     * @return UpdateRecurringBilling
+     */
+    public function setWebhook($webhook)
+    {
+        $this->webhook = $webhook;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getWebhook()
+    {
+        return $this->webhook;
+    }
+    
+    /**
+     * @param sring $save_card
+     * @return UpdateRecurringBilling
+     */
+    public function setSaveCard($save_card)
+    {
+        $this->save_card = $save_card;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSaveCard()
+    {
+        return $this->save_card;
+    }
+    
+    /**
+     * @param sring $times_to_be_charge
+     * @return UpdateRecurringBilling
+     */
+    public function setTimesToBeCharge($times_to_be_charge)
+    {
+        $this->times_to_be_charge = $times_to_be_charge;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getTimesToBeCharge()
+    {
+        return $this->times_to_be_charge;
+    }
+
+    /**
+     * @param sring $send_email
+     * @return UpdateRecurringBilling
+     */
+    public function setSendEmail($send_email)
+    {
+        $this->send_email = $send_email;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSendEmail()
+    {
+        return $this->send_email;
+    }
+
+    /**
+     * @param string $reference
+     * @return UpdateRecurringBilling
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycle()
+    {
+        return $this->cycle;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleRepeat()
+    {
+        return $this->cycle_repeat;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleFrequency()
+    {
+        return $this->cycle_frequency;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return UpdateRecurringBilling
+     */
+    public function setCycle($cycle)
+    {
+        $this->cycle = $cycle;
+
+        return $this;
+    }
+    
+    
+    /**
+     * @param sring $cycle
+     * @return UpdateRecurringBilling
+     */
+    public function setCycleRepeat($cycle_repeat)
+    {
+        $this->cycle_repeat = $cycle_repeat;
+        
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return UpdateRecurringBilling
+     */
+    public function setCycleFrequency($cycle_frequency)
+    {
+        $this->cycle_frequency = $cycle_frequency;
+        
+        return $this;
+    }
+}

+ 143 - 0
extend/hitpay/Response/ChargeSavedCard.php

@@ -0,0 +1,143 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class ChargeSavedCard
+ * @package HitPay\Response
+ */
+class ChargeSavedCard
+{
+    /**
+     * @var string
+     */
+    public $payment_id;
+
+    /**
+     * @var string
+     */
+    public $recurring_billing_id;
+
+    /**
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @var string
+     */
+    public $status;
+
+    /**
+     * ChargeSavedCard constructor.
+     * @param \stdClass $result
+     */
+    public function __construct(\stdClass $result)
+    {
+        $this->setPaymentId($result->payment_id);
+        $this->setRecurringBillingId($result->recurring_billing_id);
+        $this->setAmount($result->amount);
+        $this->setCurrency($result->currency);
+        $this->setStatus($result->status);
+    }
+
+    /**
+     * @return string
+     */
+    public function getPaymentId()
+    {
+        return $this->payment_id;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRecurringBillingId()
+    {
+        return $this->recurring_billing_id;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @return string
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+
+    /**
+     * @param string $payment_id
+     * @return ChargeSavedCard
+     */
+    public function setPaymentId($payment_id)
+    {
+        $this->payment_id = $payment_id;
+
+        return $this;
+    }
+
+    /**
+     * @param string $recurring_billing_id
+     * @return ChargeSavedCard
+     */
+    public function setRecurringBillingId($recurring_billing_id)
+    {
+        $this->recurring_billing_id = $recurring_billing_id;
+
+        return $this;
+    }
+
+    /**
+     * @param float $amount
+     * @return ChargeSavedCard
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return ChargeSavedCard
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param string $status
+     * @return ChargeSavedCard
+     */
+    public function setStatus($status)
+    {
+        $this->status = $status;
+
+        return $this;
+    }
+}

+ 540 - 0
extend/hitpay/Response/CreatePayment.php

@@ -0,0 +1,540 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class CreatePayment
+ * @package HitPay\Response
+ */
+class CreatePayment
+{
+    /**
+     * @var string
+     */
+    public $id;
+
+    /**
+     * @var string
+     */
+    public $name;
+
+    /**
+     * @var string
+     */
+    public $email;
+
+    /**
+     * @var int
+     */
+    public $phone;
+
+    /**
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @var string
+     */
+    public $status;
+
+    /**
+     * @var string
+     */
+    public $purpose;
+
+    /**
+     * @var string
+     */
+    public $reference_number;
+
+    /**
+     * @var array
+     */
+    public $payment_methods = array();
+
+    /**
+     * @var string
+     */
+    public $url;
+
+    /**
+     * @var string
+     */
+    public $redirect_url;
+
+    /**
+     * @var string
+     */
+    public $webhook;
+
+    /**
+     * @var int
+     */
+    public $send_sms;
+
+    /**
+     * @var int
+     */
+    public $send_email;
+
+    /**
+     * @var string
+     */
+    public $sms_status;
+
+    /**
+     * @var string
+     */
+    public $email_status;
+
+    /**
+     * @var string
+     */
+    public $allow_repeated_payments;
+
+    /**
+     * @var string
+     */
+    public $expiry_date;
+
+    /**
+     * @var string
+     */
+    public $created_at;
+
+    /**
+     * @var string
+     */
+    public $updated_at;
+
+    /**
+     * CreatePayment constructor.
+     * @param \stdClass $result
+     */
+    public function __construct(\stdClass $result)
+    {
+        $this->setId($result->id);
+        $this->setName($result->name);
+        $this->setEmail($result->email);
+        $this->setPhone($result->phone);
+        $this->setAmount($result->amount);
+        $this->setCurrency($result->currency);
+        $this->setStatus($result->status);
+        $this->setPurpose($result->purpose);
+        $this->setReferenceNumber($result->reference_number);
+        $this->setPaymentMethods($result->payment_methods);
+        $this->setUrl($result->url);
+        $this->setRedirectUrl($result->redirect_url);
+        $this->setWebhook($result->webhook);
+        $this->setSendSms($result->send_sms);
+        $this->setSendEmail($result->send_email);
+        $this->setSmsStatus($result->sms_status);
+        $this->setEmailStatus($result->email_status);
+        $this->setAllowRepeatedPayments($result->allow_repeated_payments);
+        $this->setExpiryDate($result->expiry_date);
+        $this->setCreatedAt($result->created_at);
+        $this->setUpdatedAt($result->updated_at);
+    }
+
+    /**
+     * @return string
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEmail()
+    {
+        return $this->email;
+    }
+
+    /**
+     * @return int
+     */
+    public function getPhone()
+    {
+        return $this->phone;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @return string
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPurpose()
+    {
+        return $this->purpose;
+    }
+
+    /**
+     * @return string
+     */
+    public function getReferenceNumber()
+    {
+        return $this->reference_number;
+    }
+
+    /**
+     * @return array
+     */
+    public function getPaymentMethods()
+    {
+        return $this->payment_methods;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUrl()
+    {
+        return $this->url;
+    }
+
+    /**
+     * @return string
+     */
+    public function getRedirectUrl()
+    {
+        return $this->redirect_url;
+    }
+
+    /**
+     * @return string
+     */
+    public function getWebhook()
+    {
+        return $this->webhook;
+    }
+
+    /**
+     * @return int
+     */
+    public function getSendSms()
+    {
+        return $this->send_sms;
+    }
+
+    /**
+     * @return int
+     */
+    public function getSendEmail()
+    {
+        return $this->send_email;
+    }
+
+    /**
+     * @return string
+     */
+    public function getSmsStatus()
+    {
+        return $this->sms_status;
+    }
+
+    /**
+     * @return string
+     */
+    public function getEmailStatus()
+    {
+        return $this->email_status;
+    }
+
+    /**
+     * @return string
+     */
+    public function getAllowRepeatedPayments()
+    {
+        return $this->allow_repeated_payments;
+    }
+
+    /**
+     * @return string
+     */
+    public function getExpiryDate()
+    {
+        return $this->expiry_date;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCreatedAt()
+    {
+        return $this->created_at;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUpdatedAt()
+    {
+        return $this->updated_at;
+    }
+
+    /**
+     * @param string $id
+     * @return CreatePayment
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+
+    /**
+     * @param string $name
+     * @return CreatePayment
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @param string $email
+     * @return CreatePayment
+     */
+    public function setEmail($email)
+    {
+        $this->email = $email;
+
+        return $this;
+    }
+
+    /**
+     * @param int $phone
+     */
+    public function setPhone($phone)
+    {
+        $this->phone = $phone;
+    }
+
+    /**
+     * @param float $amount
+     * @return CreatePayment
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return CreatePayment
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param string $status
+     * @return CreatePayment
+     */
+    public function setStatus($status)
+    {
+        $this->status = $status;
+
+        return $this;
+    }
+
+    /**
+     * @param string $purpose
+     * @return CreatePayment
+     */
+    public function setPurpose($purpose)
+    {
+        $this->purpose = $purpose;
+
+        return $this;
+    }
+
+    /**
+     * @param string $reference_number
+     * @return CreatePayment
+     */
+    public function setReferenceNumber($reference_number)
+    {
+        $this->reference_number = $reference_number;
+
+        return $this;
+    }
+
+    /**
+     * @param array $payment_methods
+     * @return CreatePayment
+     */
+    public function setPaymentMethods($payment_methods)
+    {
+        $this->payment_methods = $payment_methods;
+
+        return $this;
+    }
+
+    /**
+     * @param string $url
+     * @return CreatePayment
+     */
+    public function setUrl($url)
+    {
+        $this->url = $url;
+
+        return $this;
+    }
+
+    /**
+     * @param string $redirect_url
+     * @return CreatePayment
+     */
+    public function setRedirectUrl($redirect_url)
+    {
+        $this->redirect_url = $redirect_url;
+
+        return $this;
+    }
+
+    /**
+     * @param string $webhook
+     * @return CreatePayment
+     */
+    public function setWebhook($webhook)
+    {
+        $this->webhook = $webhook;
+
+        return $this;
+    }
+
+    /**
+     * @param int $send_sms
+     * @return CreatePayment
+     */
+    public function setSendSms($send_sms)
+    {
+        $this->send_sms = $send_sms;
+
+        return $this;
+    }
+
+    /**
+     * @param int $send_email
+     * @return CreatePayment
+     */
+    public function setSendEmail($send_email)
+    {
+        $this->send_email = $send_email;
+
+        return $this;
+    }
+
+    /**
+     * @param string $sms_status
+     * @return CreatePayment
+     */
+    public function setSmsStatus($sms_status)
+    {
+        $this->sms_status = $sms_status;
+
+        return $this;
+    }
+
+    /**
+     * @param string $email_status
+     * @return CreatePayment
+     */
+    public function setEmailStatus($email_status)
+    {
+        $this->email_status = $email_status;
+
+        return $this;
+    }
+
+    /**
+     * @param string $allow_repeated_payments
+     * @return CreatePayment
+     */
+    public function setAllowRepeatedPayments($allow_repeated_payments)
+    {
+        $this->allow_repeated_payments = $allow_repeated_payments;
+
+        return $this;
+    }
+
+    /**
+     * @param string $expiry_date
+     * @return CreatePayment
+     */
+    public function setExpiryDate($expiry_date)
+    {
+        $this->expiry_date = $expiry_date;
+
+        return $this;
+    }
+
+    /**
+     * @param string $created_at
+     * @return CreatePayment
+     */
+    public function setCreatedAt($created_at)
+    {
+        $this->created_at = $created_at;
+
+        return $this;
+    }
+
+    /**
+     * @param string $updated_at
+     * @return CreatePayment
+     */
+    public function setUpdatedAt($updated_at)
+    {
+        $this->updated_at = $updated_at;
+
+        return $this;
+    }
+}

+ 293 - 0
extend/hitpay/Response/CreateSubscriptionPlan.php

@@ -0,0 +1,293 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class CreateSubscriptionPlan
+ * @package HitPay\Response
+ */
+class CreateSubscriptionPlan
+{
+    /**
+     * @var string
+     */
+    public $id;
+
+    /**
+     * @var string
+     */
+    public $name;
+
+    /**
+     * @var string
+     */
+    public $description;
+
+    /**
+     * @var string
+     */
+    public $cycle;
+    
+    /**
+     * @var string
+     */
+    public $cycle_repeat;
+    
+    /**
+     * @var string
+     */
+    public $cycle_frequency;
+
+    /**
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @var string
+     */
+    public $reference;
+
+    /**
+     * @var string
+     */
+    public $created_at;
+
+    /**
+     * @var string
+     */
+    public $updated_at;
+
+    /**
+     * CreateSubscriptionPlan constructor.
+     * @param \stdClass $result
+     */
+    public function __construct(\stdClass $result)
+    {
+        $this->setId($result->id);
+        $this->setName($result->name);
+        $this->setDescription($result->description);
+        $this->setCycle($result->cycle);
+        $this->setAmount($result->amount);
+        $this->setCurrency($result->currency);
+        $this->setReference($result->reference);
+        $this->setCreatedAt($result->created_at);
+        $this->setUpdatedAt($result->updated_at);
+        $this->setCycleRepeat($result->cycle_repeat);
+        $this->setCycleFrequency($result->cycle_frequency);
+    }
+
+    /**
+     * @return string
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * @return string
+     */
+    public function getDescription()
+    {
+        return $this->description;
+    }
+
+    /**
+     * @return int
+     */
+    public function getCycle()
+    {
+        return $this->cycle;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleRepeat()
+    {
+        return $this->cycle_repeat;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleFrequency()
+    {
+        return $this->cycle_frequency;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCreatedAt()
+    {
+        return $this->created_at;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUpdatedAt()
+    {
+        return $this->updated_at;
+    }
+
+    /**
+     * @param string $id
+     * @return CreateSubscriptionPlan
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+
+    /**
+     * @param string $name
+     * @return CreateSubscriptionPlan
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @param string $description
+     * @return CreateSubscriptionPlan
+     */
+    public function setDescription($description)
+    {
+        $this->description = $description;
+
+        return $this;
+    }
+
+    /**
+     * @param string $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycle($cycle)
+    {
+        $this->cycle = $cycle;
+        
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycleRepeat($cycle_repeat)
+    {
+        $this->cycle_repeat = $cycle_repeat;
+        
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return CreateSubscriptionPlan
+     */
+    public function setCycleFrequency($cycle_frequency)
+    {
+        $this->cycle_frequency = $cycle_frequency;
+        
+        return $this;
+    }
+
+    /**
+     * @param float $amount
+     * @return CreateSubscriptionPlan
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return CreateSubscriptionPlan
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param string $reference
+     * @return CreateSubscriptionPlan
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+
+        return $this;
+    }
+
+    /**
+     * @param string $created_at
+     * @return CreateSubscriptionPlan
+     */
+    public function setCreatedAt($created_at)
+    {
+        $this->created_at = $created_at;
+
+        return $this;
+    }
+
+    /**
+     * @param string $updated_at
+     * @return CreateSubscriptionPlan
+     */
+    public function setUpdatedAt($updated_at)
+    {
+        $this->updated_at = $updated_at;
+
+        return $this;
+    }
+}

+ 43 - 0
extend/hitpay/Response/DeletePaymentRequest.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class DeletePaymentRequest - https://staging.hit-pay.com/docs.html?shell#delete-payment-request
+ * @package HitPay\Response
+ */
+class DeletePaymentRequest
+{
+    /**
+     * @var int
+     */
+    public $success;
+
+    /**
+     * DeletePaymentRequest constructor.
+     * @param \stdClass $response
+     */
+    public function __construct(\stdClass $response)
+    {
+        $this->setSuccess($response->success);
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getSuccess()
+    {
+        return $this->success;
+    }
+
+    /**
+     * @param mixed $success
+     * @return DeletePaymentRequest
+     */
+    public function setSuccess($success)
+    {
+        $this->success = $success;
+
+        return $this;
+    }
+}

+ 50 - 0
extend/hitpay/Response/PaymentStatus.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class PaymentStatus - https://staging.hit-pay.com/docs.html?shell#get-payment-status
+ *
+ * @package HitPay\Response
+ */
+class PaymentStatus extends CreatePayment
+{
+    /**
+     * array of payments made to this request ID. Will contain more than one if its a repeating payment link
+     *
+     * @var array
+     */
+    public $payments;
+
+    /**
+     * PaymentStatus constructor.
+     * @param \stdClass $response
+     */
+    public function __construct(\stdClass $response)
+    {
+        parent::__construct($response);
+
+        if (isset($response->payments)) {
+            $this->setPayments($response->payments);
+        }
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getPayments()
+    {
+        return $this->payments;
+    }
+
+    /**
+     * @param mixed $payments
+     * @return PaymentStatus
+     */
+    public function setPayments($payments)
+    {
+        $this->payments = $payments;
+
+        return $this;
+    }
+}

+ 617 - 0
extend/hitpay/Response/RecurringBilling.php

@@ -0,0 +1,617 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class RecurringBilling
+ * @package HitPay\Response
+ */
+class RecurringBilling
+{
+    /**
+     * @var string
+     */
+    public $id;
+    
+    /**
+     * @var string
+     */
+    public $business_recurring_plans_id;
+
+    /**
+     * @var string
+     */
+    public $customer_name;
+    
+    /**
+     * @var string
+     */
+    public $customer_email;
+    
+    /**
+     * @var string
+     */
+    public $name;
+
+    /**
+     * @var string
+     */
+    public $description;
+    
+    /**
+     * @var string
+     */
+    public $reference;
+
+    /**
+     * @var string
+     */
+    public $cycle;
+    
+    /**
+     * @var string
+     */
+    public $cycle_repeat;
+    
+    /**
+     * @var string
+     */
+    public $cycle_frequency;
+
+    /**
+     * @var float
+     */
+    public $amount;
+
+    /**
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @var string
+     */
+    public $created_at;
+
+    /**
+     * @var string
+     */
+    public $updated_at;
+    
+    /**
+     * @var string
+     */
+    public $expires_at;
+    
+    /**
+     * @var string
+     */
+    public $status;
+    
+    /**
+     * @var array
+     */
+    public $payment_methods = array();
+    
+    /**
+     * @var string
+     */
+    public $redirect_url;
+
+    /**
+     * @var string
+     */
+    public $url;
+    
+    /**
+     * @var string
+     */
+    public $times_to_be_charged;
+    
+    /**
+     * @var string
+     */
+    public $times_charged;
+    
+    /**
+     * @var string
+     */
+    public $webhook;
+
+    /**
+     * @var string
+     */
+    public $save_card;
+    
+    /**
+     * @var string
+     */
+    public $send_email;
+
+    /**
+     * RecurringBilling constructor.
+     * @param \stdClass $result
+     */
+    public function __construct(\stdClass $result)
+    {
+        $this->setId($result->id);
+        $this->setBusinessRecurringPlansId($result->business_recurring_plans_id);
+        $this->setCustomerName($result->customer_name);
+        $this->setCustomerEmail($result->customer_email);
+        $this->setName($result->name);
+        $this->setDescription($result->description);
+        $this->setCycle($result->cycle);
+        $this->setAmount($result->amount);
+        $this->setCurrency($result->currency);
+        $this->setStatus($result->status);
+        $this->setTimesToBeCharged($result->times_to_be_charged);
+        $this->setTimesCharged($result->times_charged);
+        $this->setCreatedAt($result->created_at);
+        $this->setUpdatedAt($result->updated_at);
+        $this->setExpiresAt($result->expires_at);
+        $this->setRedirectUrl($result->redirect_url);
+        $this->setUrl($result->url);
+        $this->setPaymentMethods($result->payment_methods);
+        $this->setReference($result->reference);
+        $this->setCycleRepeat($result->cycle_repeat);
+        $this->setCycleFrequency($result->cycle_frequency);
+        $this->setWebhook($result->webhook);
+        $this->setSaveCard($result->save_card);
+        $this->setSendEmail($result->send_email);
+    }
+
+    /**
+     * @param string $id
+     * @return RecurringBIlling
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+    
+    /**
+     * @param string $business_recurring_plans_id
+     * @return RecurringBIlling
+     */
+    public function setBusinessRecurringPlansId($business_recurring_plans_id)
+    {
+        $this->business_recurring_plans_id = $business_recurring_plans_id;
+
+        return $this;
+    }
+    
+        /**
+     * @return string
+     */
+    public function getBusinessRecurringPlansId()
+    {
+        return $this->business_recurring_plans_id;
+    }
+    
+    /**
+     * @param string $customer_name
+     * @return RecurringBIlling
+     */
+    public function setCustomerName($customer_name)
+    {
+        $this->customer_name = $customer_name;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCustomerName()
+    {
+        return $this->customer_name;
+    }
+    
+    /**
+     * @param float $customer_email
+     * @return RecurringBIlling
+     */
+    public function setCustomerEmail($customer_email)
+    {
+        $this->customer_email = $customer_email;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCustomerEmail()
+    {
+        return $this->customer_email;
+    }
+    
+    /**
+     * @param string $name
+     * @return RecurringBIlling
+     */
+    public function setName($name)
+    {
+        $this->name = $name;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+    
+     /**
+     * @param string $description
+     * @return RecurringBIlling
+     */
+    public function setDescription($description)
+    {
+        $this->description = $description;
+
+        return $this;
+    }   
+
+    /**
+     * @return string
+     */
+    public function getDescription()
+    {
+        return $this->description;
+    }
+    
+    /**
+     * @param string $cycle
+     * @return RecurringBIlling
+     */
+    public function setCycle($cycle)
+    {
+        $this->cycle = $cycle;
+    }
+
+    /**
+     * @return int
+     */
+    public function getCycle()
+    {
+        return $this->cycle;
+    }
+    
+    /**
+     * @param string $currency
+     * @return RecurringBIlling
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+    
+    /**
+     * @param float $amount
+     * @return RecurringBIlling
+     */
+    public function setAmount($amount)
+    {
+        $this->amount = $amount;
+
+        return $this;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmount()
+    {
+        return $this->amount;
+    }
+    
+    /**
+     * @param string $times_to_be_charged
+     * @return RecurringBIlling
+     */
+    public function setTimesToBeCharged($times_to_be_charged)
+    {
+        $this->times_to_be_charged = $times_to_be_charged;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getTimesToBeCharged()
+    {
+        return $this->times_to_be_charged;
+    }
+    
+    /**
+     * @param string $times_charged
+     * @return RecurringBIlling
+     */
+    public function setTimesCharged($times_charged)
+    {
+        $this->times_charged = $times_charged;
+
+        return $this;
+    }
+    
+     /**
+     * @return string
+     */
+    public function getTimesCharged()
+    {
+        return $this->times_charged;
+    }
+    
+    /**
+     * @param string $status
+     * @return RecurringBIlling
+     */
+    public function setStatus($status)
+    {
+        $this->status = $status;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+    
+    /**
+     * @param string $redirect_url
+     * @return RecurringBIlling
+     */
+    public function setRedirectUrl($redirect_url)
+    {
+        $this->redirect_url = $redirect_url;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getRedirectUrl()
+    {
+        return $this->redirect_url;
+    }
+    
+    /**
+     * @param array $payment_methods
+     * @return RecurringBIlling
+     */
+    public function setPaymentMethods($payment_methods)
+    {
+        $this->payment_methods = $payment_methods;
+
+        return $this;
+    }
+    
+    /**
+     * @return array
+     */
+    public function getPaymentMethods()
+    {
+        return $this->payment_methods;
+    }
+    
+    /**
+     * @param string $created_at
+     * @return RecurringBIlling
+     */
+    public function setCreatedAt($created_at)
+    {
+        $this->created_at = $created_at;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCreatedAt()
+    {
+        return $this->created_at;
+    }
+    
+    /**
+     * @param string $updated_at
+     * @return RecurringBIlling
+     */
+    public function setUpdatedAt($updated_at)
+    {
+        $this->updated_at = $updated_at;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getUpdatedAt()
+    {
+        return $this->updated_at;
+    }
+
+    /**
+     * @param string $expires_at
+     * @return RecurringBIlling
+     */
+    public function setExpiresAt($expires_at)
+    {
+        $this->expires_at = $expires_at;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getExpiresAt()
+    {
+        return $this->expires_at;
+    }
+    
+    /**
+     * @param string $url
+     * @return RecurringBIlling
+     */
+    public function setUrl($url)
+    {
+        $this->url = $url;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getUrl()
+    {
+        return $this->url;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getReference()
+    {
+        return $this->reference;
+    }
+    
+    /**
+     * @param string $reference
+     * @return RecurringBIlling
+     */
+    public function setReference($reference)
+    {
+        $this->reference = $reference;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleRepeat()
+    {
+        return $this->cycle_repeat;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getCycleFrequency()
+    {
+        return $this->cycle_frequency;
+    }
+    
+    
+    /**
+     * @param sring $cycle
+     * @return RecurringBIlling
+     */
+    public function setCycleRepeat($cycle_repeat)
+    {
+        $this->cycle_repeat = $cycle_repeat;
+        
+        return $this;
+    }
+    
+    /**
+     * @param sring $cycle
+     * @return RecurringBIlling
+     */
+    public function setCycleFrequency($cycle_frequency)
+    {
+        $this->cycle_frequency = $cycle_frequency;
+        
+        return $this;
+    }
+    
+    /**
+     * @param string $webhook
+     * @return RecurringBIlling
+     */
+    public function setWebhook($webhook)
+    {
+        $this->webhook = $webhook;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getWebhook()
+    {
+        return $this->webhook;
+    }
+    
+    /**
+     * @param sring $save_card
+     * @return RecurringBIlling
+     */
+    public function setSaveCard($save_card)
+    {
+        $this->save_card = $save_card;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSaveCard()
+    {
+        return $this->save_card;
+    }
+    
+    /**
+     * @param sring $send_email
+     * @return RecurringBIlling
+     */
+    public function setSendEmail($send_email)
+    {
+        $this->send_email = $send_email;
+
+        return $this;
+    }
+    
+    /**
+     * @return string
+     */
+    public function getSendEmail()
+    {
+        return $this->send_email;
+    }
+}

+ 218 - 0
extend/hitpay/Response/Refund.php

@@ -0,0 +1,218 @@
+<?php
+
+namespace HitPay\Response;
+
+/**
+ * Class Refund
+ * @package HitPay\Response
+ */
+class Refund
+{
+    /**
+     * @var string
+     */
+    public $id;
+
+    /**
+     * @var string
+     */
+    public $payment_id;
+
+    /**
+     * @var float
+     */
+    public $amount_refunded;
+
+    /**
+     * @var float
+     */
+    public $total_amount;
+
+    /**
+     * @var string
+     */
+    public $currency;
+
+    /**
+     * @var string
+     */
+    public $status;
+
+    /**
+     * @var string
+     */
+    public $payment_method;
+
+    /**
+     * @var string
+     */
+    public $created_at;
+
+    /**
+     * Refund constructor.
+     * @param \stdClass $result
+     */
+    public function __construct(\stdClass $result)
+    {
+        $this->setId($result->id);
+        $this->setPaymentId($result->payment_id);
+        $this->setAmountRefunded($result->amount_refunded);
+        $this->setTotalAmount($result->total_amount);
+        $this->setCurrency($result->currency);
+        $this->setStatus($result->status);
+        $this->setPaymentMethod($result->payment_method);
+        $this->setCreatedAt($result->created_at);
+    }
+
+    /**
+     * @return string
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPaymentId()
+    {
+        return $this->payment_id;
+    }
+
+    /**
+     * @return float
+     */
+    public function getAmountRefunded()
+    {
+        return $this->amount_refunded;
+    }
+
+    /**
+     * @return float
+     */
+    public function getTotalAmount()
+    {
+        return $this->total_amount;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCurrency()
+    {
+        return $this->currency;
+    }
+
+    /**
+     * @return string
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPaymentMethod()
+    {
+        return $this->payment_method;
+    }
+
+    /**
+     * @return string
+     */
+    public function getCreatedAt()
+    {
+        return $this->created_at;
+    }
+
+    /**
+     * @param string $id
+     * @return Refund
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+
+    /**
+     * @param string $name
+     * @return Refund
+     */
+    public function setPaymentId($payment_id)
+    {
+        $this->payment_id = $payment_id;
+
+        return $this;
+    }
+
+    /**
+     * @param string $amount_refunded
+     * @return Refund
+     */
+    public function setAmountRefunded($amount_refunded)
+    {
+        $this->amount_refunded = $amount_refunded;
+
+        return $this;
+    }
+
+    /**
+     * @param float $total_amount
+     * @return Refund
+     */
+    public function setTotalAmount($total_amount)
+    {
+        $this->total_amount = $total_amount;
+
+        return $this;
+    }
+
+    /**
+     * @param string $currency
+     * @return Refund
+     */
+    public function setCurrency($currency)
+    {
+        $this->currency = $currency;
+
+        return $this;
+    }
+
+    /**
+     * @param string $status
+     * @return Refund
+     */
+    public function setStatus($status)
+    {
+        $this->status = $status;
+
+        return $this;
+    }
+
+    /**
+     * @param array $payment_methods
+     * @return Refund
+     */
+    public function setPaymentMethod($payment_method)
+    {
+        $this->payment_method = $payment_method;
+
+        return $this;
+    }
+
+    /**
+     * @param string $created_at
+     * @return Refund
+     */
+    public function setCreatedAt($created_at)
+    {
+        $this->created_at = $created_at;
+
+        return $this;
+    }
+}