Skip to content

Mondido PHP SDK 2.0 #3

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

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce2c37e
Added a composer file and updated gitignore to ignore the vendor fold…
phroggyy Jul 21, 2015
4f89bc9
Refactored for PSR-0 compliance
phroggyy Jul 21, 2015
2f61762
Added a helper to convert strings to snake_case to ensure compatibili…
phroggyy Jul 21, 2015
0090192
Made the API base have the username, password, and secret attributes …
phroggyy Jul 21, 2015
03e8364
Made the Mondido object useful by letting it be instantiated to acces…
phroggyy Jul 21, 2015
e82e2ea
Added the attributes as arrays instead, with a secondary array for al…
phroggyy Jul 21, 2015
b649036
updated composer to autoload our base testcase in dev, and to always …
phroggyy Jul 21, 2015
5910438
Explicitly exclude the test base in phpunit
phroggyy Jul 21, 2015
4770320
Converted tests to use the new api and made some logical and syntacti…
phroggyy Jul 21, 2015
b012d17
ignore the json file created during tests
phroggyy Jul 21, 2015
8213d73
make the TestBase instantiate the api with given credentials
phroggyy Jul 21, 2015
c3f45f0
Make sure we create a new transaction instead of getting a fixed one
phroggyy Jul 21, 2015
f2f9f5e
Updated read and made compliant with PHP 5.3 by using the explicit ar…
phroggyy Jul 21, 2015
1eb3fab
added a method to generate a form that will send a post request to mo…
phroggyy Jul 21, 2015
1f54ceb
Added the javascript for submitting the form
phroggyy Jul 21, 2015
7989819
generate hash for forms. They can also be generated manually by the c…
phroggyy Jul 21, 2015
e400652
Make sure we format the amount correctly before placing it in the form
phroggyy Jul 22, 2015
b4d717f
Refactored and added the customer api
phroggyy Aug 13, 2015
ba77bbb
use the API parts as variables
phroggyy Aug 13, 2015
00734cc
added a subscription model
phroggyy Aug 13, 2015
d91e541
Added an all method to subscription and a constructor to the base model
phroggyy Aug 13, 2015
e4f3091
Added plans API
phroggyy Aug 13, 2015
b215c3c
add the subscription and plan to the main api
phroggyy Aug 13, 2015
9d70135
Added an update method to the plan API
phroggyy Aug 13, 2015
ba40a13
plans can't be updated, subscriptions can...
phroggyy Aug 13, 2015
8f872eb
Added a method for easier making http requests to the api by automati…
phroggyy Aug 14, 2015
de515f1
Bug fixes
phroggyy Aug 18, 2015
324d6b6
bug fix
phroggyy Aug 18, 2015
7c9cda8
Renamed to upper case
phroggyy Aug 19, 2015
2dec8f9
Removed all the badly named
phroggyy Aug 20, 2015
39cb34d
Added docblocks and a method to create subscriptions
phroggyy Aug 24, 2015
ca0fa02
Use PHP 5.3 compatible array
phroggyy Aug 24, 2015
96e534c
cs fix
phroggyy Aug 24, 2015
f6768bf
PHP 5.3 compatibility with array syntax adjustments
emilsundberg Aug 24, 2015
573b247
Allow users to pass the filter directly without wrapping it as an arr…
phroggyy Aug 27, 2015
79bf46e
Set testmode parameter value according to docs
emilsundberg Jun 27, 2016
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
49 changes: 37 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
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.
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