Download the PHP package suretly/php7-sdk without Composer
On this page you can find all versions of the php package suretly/php7-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php7-sdk
Suretly LenderAPI SDK
PHP7 SDK for Suretly Lender API
Installing LenderAPI SDK
The recommended way to install LenderAPI SDK is through Composer.
Next, run the Composer command to install the latest stable version of LenderAPI SDK:
After installing, you need to require Composer's autoloader:
Use
After installing, you need to create a new Suretly\LenderApi\LenderManager
.
Include LenderManager class
You can create SDK from static method:
Or you can create a configuration for your connection and create a LenderManager:
Calling API methods with SDK
1 General methods
1.1 Getting parameters for surety search
1.2 Orders list
Get orders with parameter $limit
and optional parameter $skip
.
The limit parameter must be set in the range from 0 to 25.
2 Creating and handling orders
2.2 Create surety order
For a create a new order, you must create a new Suretly\LenderApi\Model\NewOrder
object.
After, you can add new order on Suretly server with method postNewOrder
:
Method postNewOrder
return object with 2 fields
For example, json data
2.3 Get order status
To get the status of the order, run method getOrderStatus
, which return Suretly\LenderApi\Model\OrderStatus object:
For example, json data
2.4 Get public Order and public Order Url
To get a order, you must call method getOrder
with parameter $orderID
:
For example, json data for Borrower with russian passport:
2.5 Cancel order
For a cancel the order, you must call method postOrderStop
with parameter $orderID
:
2.6 Get borrower contract
To get a contract for a Borrower, you must call method getContract
with parameter $orderID
:
Method getContract
return HTML code:
2.7 Confirm that contract is signed by borrower
To confirm that contract is signed by borrower:
2.8 Confirm that order is paid and issued
To confirm that order is paid and issued:
2.9 8 Confirm that order is paid
To confirm that order is paid:
2.10 Confirm that order is partial paid
To confirm that order is partial paid:
2.11 Prolong order
To get fee_amount prolong order, you must run method getOrderProlong
with parameter $orderID
and parameter $days
, which return float value:
For example, json data
To prolong order, you must call method postOrderUnpaid
2.13 Upload borrower image
To upload a borrower image, you must call method postUploadImageOrder
with parameter $orderID
, parameter $realPathToFile
, which is realpath to file, and optional parameter $filename
:
2.14 Mark loan as overdue
Mark loan as overdue:
Dictionaries
Currencies
For example, json data
Countries
For example, json data
Work with errors
All SDK methods should use try/catch. For example:
All SDK methods call ResponseErrorException when an error occurs on the server.
You can see all errors in class - SuretlySDK\Type\ResponseErrorStatusType
.
Migration
version v0.3, v0.4 to v1.0
Now, you should use LenderManager instead Suretly.
Also, all field on Model is private and you should use getters and setters.
That's all.
Development
For run examples test in root project directory run commands
For run unit tests in root project directory run command in console
For Windows