diff --git a/composer.json b/composer.json index 687e78e..a581ed3 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "opay/merchant-cashier-php", - "version": "1.0.0", + "version": "1.0.1", "description": "Merchant Pre-Order API", "type": "library", "authors": [ diff --git a/http_example/callback.php b/http_example/callback.php new file mode 100644 index 0000000..59324de --- /dev/null +++ b/http_example/callback.php @@ -0,0 +1,48 @@ +orderStatus($_orderStatusRequest); + +$response = $merchantCashier->getOrderStatusApiResult(); + +file_put_contents('./log_'.date("j.n.Y").'.log', 'code: '.json_encode($response->getCode()). "\n", FILE_APPEND); +file_put_contents('./log_'.date("j.n.Y").'.log', 'data: '.json_encode($response->getData()). "\n", FILE_APPEND); + +// Example of data posted in callback +// { +// "payload": { +// "country": "NG", +// "instrumentId": "useless", +// "fee": "0.00", +// "channel": "Web", +// "reference": "test_20196699559858800", +// "updated_at": "2019-12-13T09:36:58Z", +// "currency": "NGN", +// "refunded": false, +// "instrument-id": "useless", +// "timestamp": "2019-12-13T09:36:58Z", +// "amount": "0.10", +// "instrumentType": "coins", +// "instrument_id": "useless", +// "transactionId": "191213140104849949", +// "token": "191213140104849949", +// "bussinessType": "Consumption_H5", +// "payChannel": "BalancePayment", +// "status": "failed" +// }, +// "sha512": "9cc847600cb7104b0a5a48976e70cf74763eb69f123a282975de1c3a751128c12d437b1f7c7d4a24bdb82b79aaa477e98e81bc66be8e8d8c3c15cdfcea730553", +// "type": "transaction-status" +// } + + + diff --git a/http_example/init.php b/http_example/init.php new file mode 100644 index 0000000..66a877c --- /dev/null +++ b/http_example/init.php @@ -0,0 +1,11 @@ +order($_orderRequest); + +$response = $merchantCashier->getOrderApiResult(); + +echo "status : ". $response->getCode(). "
"; + +if($response->getCode() === "00000") { + var_dump($response->getData()); +} + +function getUserIP() { + $ipaddress = ''; + if (isset($_SERVER['HTTP_CLIENT_IP'])) + $ipaddress = $_SERVER['HTTP_CLIENT_IP']; + else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) + $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; + else if(isset($_SERVER['HTTP_X_FORWARDED'])) + $ipaddress = $_SERVER['HTTP_X_FORWARDED']; + else if(isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) + $ipaddress = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP']; + else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) + $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; + else if(isset($_SERVER['HTTP_FORWARDED'])) + $ipaddress = $_SERVER['HTTP_FORWARDED']; + else if(isset($_SERVER['REMOTE_ADDR'])) + $ipaddress = $_SERVER['REMOTE_ADDR']; + else + $ipaddress = 'UNKNOWN'; + return $ipaddress; +} +?> + diff --git a/http_example/order_status.php b/http_example/order_status.php new file mode 100644 index 0000000..42bfc9e --- /dev/null +++ b/http_example/order_status.php @@ -0,0 +1,7 @@ +