Skip to content

Mondido PHP SDK 2.0 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.idea


/vendor/
wh.json
51 changes: 38 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,50 @@
php_sdk 1.2
#Mondido PHP SDK 2.0 by Snowfire
=======

The PHP SDK for Mondido Payments
To get started with the SDK, simply run `composer require snowfire/mondido-php-sdk` and include the composer-generated `autoload.php`.

Every time you wish to use the api through the SDK, you must first instantiate the `Mondido\Mondido` class with your merchant id, password and secret. If you plan to use this in more than one place, it is recommended to place this instantiation in a constructor, trait or similar.

```php

You can then access the different api features through your main instance.

## Example

```
<?php
error_reporting(-1);
include_once 'mondido_sdk.php';

//get the transaction id from the POST
$transaction = mondido\mondido_sdk::getWebHook();
//get the id
$transaction_id = $transaction['id'];
//log to file
mondido\mondido_sdk::logToFile('log.txt',$transaction);

namespace Foo\Bar

class MondidoExample
{

private $api;

public function __construct()
{
$merchantId = 'yourMerchantId';
$password = 'yourApiPassword';
$secret = 'yourApiSecret';

$this->api = new Mondido\Mondido($merchantId, $password, $secret);
}

public function recordPayment($data)
{
$transaction = $this->api->transaction()->create($data);
}
}
```
For complete API documentation, please visit [Mondido](https://doc.mondido.com/api).


The unit tests require PHPUnit to be installed and run `phpunit test/`

*Changelog*
- 2.0, Transitioned to non-static api
- 2.0, Refactored all code for PSR-0
- 2.0, Fixed tests
- 2.0, Bug and syntax fixes
- 1.2, Updated Hash recipe, refactor models, etc.

IMPORTANT:
Expand Down Expand Up @@ -127,4 +152,4 @@ Secure Socket Layer is required to securely transfer cardholder data and payment
* Instagram - https://www.instagram.com/mondidopay/


Do not hesitate to contact support@mondido.com for any questions!
Do not hesitate to contact support@mondido.com for any questions!
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "snowfire/mondido-php-sdk",
"description": "A fork of the Mondido PHP SDK available on composer",
"authors": [
{
"name": "Leo Sjöberg",
"email": "leo@snowfire.net"
}
],
"require": {},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-4": {
"Mondido\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestBase.php"
]
}
}
Loading