-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit afa187e
Showing
105 changed files
with
11,405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Files created by OSX | ||
._* | ||
.DS_Store | ||
|
||
# Emacs back up files | ||
*~ | ||
*# | ||
|
||
composer.lock | ||
composer-psalm.lock | ||
composer.phar | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: php | ||
matrix: | ||
include: | ||
- php: 5.3 | ||
env: | ||
- TEST_SUITE='no_psalm' | ||
- php: 5.4 | ||
env: | ||
- TEST_SUITE='no_psalm' | ||
- php: 5.5 | ||
env: | ||
- TEST_SUITE='no_psalm' | ||
- php: 5.6 | ||
env: | ||
- TEST_SUITE='with_psalm' | ||
- COMPOSER='composer-psalm.json' | ||
- php: 7.0 | ||
env: | ||
- TEST_SUITE='with_psalm' | ||
- COMPOSER='composer-psalm.json' | ||
- php: 7.1 | ||
env: | ||
- TEST_SUITE='with_psalm' | ||
- COMPOSER='composer-psalm.json' | ||
install: composer install | ||
script: make $TEST_SUITE | ||
notifications: | ||
email: false | ||
slack: | ||
rooms: | ||
secure: Lt+vBT6MMM0MQSmkdBRlr0LqhA6ZB+sJJm0AkwOMWCIWNa3GSTnPztOvy3+G/mEnpQaXFHwctu4vuDNi/tXaIGndKgFjrmfkNS+ZMGWoQrxe3hjY4jZUSPhOJldoD0StER7ka0tf0frPQKd3baRV5JBr2KH1O8sZ3JlP/RCO3HKXL50VSYNA0oXJQmJocazqQQT0BWO4oQLHz2XtNLNQMJBG+zhN8tDvnqkDlUhuO0INHkBvRvmqiQ5dN25IR5OemRgrVrYWZzejfoxzTONXB+9SlBU9zwphvqTEwiHw9xE1VQDIoCv9o13y9qsS7xt2ojIMScWWJioaq03uPy/vI+tnT98Oaa1tJGDQkdbN83Am28KDAY5BA6445RSuyNPGoQXoHtzqFLBpPV+xzwMb+gBYPxQ71U3YFkFavwlHvEPUU/wslTdFkTHbRXXEuRgYeVpH7O3ZbxW3xRnWwzWPB7SXcb6CkMmX+ByuyS5x4The59Y5AvYjp5fGlHZgv8aqhqOPWz8PdEj5qqK6+2VCsVuwU55hmS4zATZjPGyZLqFnOpSBw5raQq0iSeSKoq683p4iCGWoiUYdaXi+DcWjfJCo4UbbGvWSbTzLeRkEA44bdY3Noeg8dkccfaOqZQF/FoVMhD04WNkmn2int4gvlRHF9RbHjrah+gaRAxLSFvk= | ||
on_pull_requests: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Contributing Guidelines | ||
|
||
## Steps | ||
* Fork the project. | ||
* Make your feature addition or bug fix. | ||
* Add tests for it. This is important so we don't break it in a future version unintentionally. | ||
* Commit just the modifications, do not mess with the composer.json file. | ||
* Ensure your code is nicely formatted in the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) | ||
style and that all tests pass. | ||
* Send the pull request. | ||
* Check that the Travis CI build passed. If not, rinse and repeat. **Note:** This repo uses [Psalm](https://github.com/vimeo/psalm) to statically analyze all the code. Psalm runs on all the builds for PHP 5.5+. | ||
|
||
**NOTE:** This repo requires pull-request reviews for all changes on branches bound for production in accordance with Vimeo policy. | ||
|
||
## Testing locally | ||
To install Psalm and run the full test suite locally, download [Composer](https://getcomposer.org/) into the repository and then run: | ||
|
||
``` | ||
make install | ||
make | ||
``` | ||
|
||
If you use PHP 5.3 or 5.4 locally (which are not supported by the latest version of Psalm), you can skip Psalm by running: | ||
|
||
``` | ||
make install_no_psalm | ||
make no_psalm | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Vimeo, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Test | ||
|
||
all: with_psalm | ||
|
||
no_psalm: style test | ||
|
||
with_psalm: style psalm test | ||
|
||
style: | ||
vendor/bin/phpcs --standard=PSR2 src && vendor/bin/phpcs --standard=PSR2 --error-severity=1 --warning-severity=6 tests | ||
|
||
test: | ||
vendor/bin/phpunit | ||
|
||
psalm: | ||
vendor/bin/psalm | ||
|
||
# Install | ||
|
||
install: install_with_psalm | ||
|
||
install_with_psalm: | ||
COMPOSER=composer-psalm.json php composer.phar install | ||
|
||
install_no_psalm: | ||
php composer.phar install | ||
|
||
# Update | ||
|
||
update: update_with_psalm | ||
|
||
update_with_psalm: | ||
COMPOSER=composer-psalm.json php composer.phar update | ||
|
||
update_no_psalm: | ||
php composer.phar update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Omnipay: BlueSnap | ||
|
||
**BlueSnap driver for the Omnipay PHP payment processing library** | ||
|
||
_NOTE: At this time, this driver only provides full support for BlueSnap's [BuyNow Hosted Checkout](https://home.bluesnap.com/features-tools/flexible-integration-options/hosted-checkout/) product. But you can add support for more parts of the API!_ | ||
|
||
[![Build Status](https://travis-ci.org/vimeo/omnipay-bluesnap.png?branch=master)](https://travis-ci.org/vimeo/omnipay-bluesnap) | ||
[![Latest Stable Version](https://poser.pugx.org/vimeo/omnipay-bluesnap/version.png)](https://packagist.org/packages/vimeo/omnipay-bluesnap) | ||
[![Total Downloads](https://poser.pugx.org/vimeo/omnipay-bluesnap/d/total.png)](https://packagist.org/packages/vimeo/omnipay-bluesnap) | ||
|
||
[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements BlueSnap support for Omnipay. | ||
|
||
[BlueSnap](https://bluesnap.com/) is a payment services provider based in Waltham, Massachusetts. In addition to traditional payment gateway services, they provide hosted solutions and a range of global payment methods. | ||
|
||
## Installation | ||
|
||
Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file: | ||
|
||
```json | ||
{ | ||
"require": { | ||
"vimeo/omnipay-bluesnap": "2.0.*" | ||
} | ||
} | ||
``` | ||
|
||
And run composer to update your dependencies: | ||
|
||
``` | ||
$ curl -s http://getcomposer.org/installer | php | ||
$ php composer.phar update | ||
``` | ||
|
||
_(Note that we recommend pinning the minor version. While `v2.*` will remain fully compatible with Omnipay 2, features added in addition to the base Omnipay features, such as subscriptions, may have breaking changes in a minor version bump.)_ | ||
|
||
## Basic Usage | ||
|
||
The following gateways are provided by this package: | ||
|
||
* BlueSnap_HostedCheckout, for [BlueSnap's BuyNow Hosted Checkout](https://support.bluesnap.com/v2.2.7/docs/intro-extended-api) page. | ||
|
||
Some features of the following gateways are provided, but not enough to use them on their own. Feel free to contribute! | ||
|
||
* BlueSnap, for BlueSnap's traditional [Payment API](https://developers.bluesnap.com/v8976-JSON/docs). This gateway is almost entirely unimplemented at this time, except for parts of the [Reporting API](https://developers.bluesnap.com/v8976-Tools/docs). | ||
* BlueSnap\_Extended, for the BlueSnap [Extended Payment API](https://support.bluesnap.com/v2.2.7/docs/intro-extended-api). This is the API you should use if you're hosting your product catalog with BlueSnap. It powers the BuyNow Hosted Checkout, as well as other products. Enough of this API is implemented in this driver to power the BlueSnap\_HostedCheckout gateway. | ||
|
||
### Simple Example | ||
|
||
```php | ||
// Set up the gateway | ||
$gateway = \Omnipay\Omnipay::create('BlueSnap_HostedCheckout'); | ||
$gateway->setUsername('your_username'); | ||
$gateway->setPassword('y0ur_p4ssw0rd'); | ||
$gateway->setTestMode(false); | ||
|
||
// Start the purchase process | ||
$purchaseResponse = $gateway->purchase(array( | ||
'storeReference' => '12345', | ||
'planReference' => '1234567', | ||
'currency' => 'USD' | ||
))->send(); | ||
|
||
if ($purchaseResponse->isSuccessful()) { | ||
$purchaseResponse->redirect(); | ||
} else { | ||
// error handling | ||
} | ||
|
||
// Now the user is filling out info on BlueSnap's hosted checkout page. Then they get | ||
// redirected back to your site. If you set parameters in the return/callback URL, you | ||
// can access those here. | ||
|
||
// Once the transaction has been captured, you'll receive an IPN callback, which you can | ||
// handle like so: | ||
|
||
$ipnCallback = $gateway->parseIPNCallback($_SERVER['REQUEST_URI']); | ||
if ($ipnCallback->isCharge()) { | ||
echo 'Transaction reference: ' . $ipnCallback->getTransactionReference() . PHP_EOL; | ||
echo 'Amount: ' . $ipnCallback->getAmount() . PHP_EOL; | ||
echo 'Currency: ' . $ipnCallback->getCurrency() . PHP_EOL; | ||
} elseif ($ipnCallback->isCancellation()) { | ||
// etc. | ||
} | ||
``` | ||
|
||
More documentation and examples are provided in the Gateway source files. | ||
|
||
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository. | ||
|
||
## Test Mode | ||
|
||
BlueSnap accounts have a separate username and password for test mode. There is also a separate test mode endpoint, which this library will use when set to test mode. | ||
|
||
## Support | ||
|
||
This driver is very new and at this point may not be completely reliable. If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/Vimeo/omnipay-bluesnap/issues), or better yet, fork the library and submit a pull request. | ||
|
||
If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the | ||
[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found. | ||
|
||
If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "vimeo/omnipay-bluesnap", | ||
"type": "library", | ||
"description": "BlueSnap driver for the Omnipay payment processing library", | ||
"keywords": [ | ||
"gateway", | ||
"merchant", | ||
"omnipay", | ||
"pay", | ||
"payment", | ||
"bluesnap" | ||
], | ||
"homepage": "https://github.com/vimeo/omnipay-bluesnap", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Nicky Robinson", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Omnipay\\BlueSnap\\Test\\" : "tests/", | ||
"Omnipay\\BlueSnap\\" : "src/" | ||
} | ||
}, | ||
"require": { | ||
"omnipay/common": "~2.0" | ||
}, | ||
"require-dev": { | ||
"omnipay/tests": "~2.0", | ||
"vimeo/psalm": "0.3.*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "vimeo/omnipay-bluesnap", | ||
"type": "library", | ||
"description": "BlueSnap driver for the Omnipay payment processing library", | ||
"keywords": [ | ||
"gateway", | ||
"merchant", | ||
"omnipay", | ||
"pay", | ||
"payment", | ||
"bluesnap" | ||
], | ||
"homepage": "https://github.com/vimeo/omnipay-bluesnap", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Nicky Robinson", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Omnipay\\BlueSnap\\Test\\" : "tests/", | ||
"Omnipay\\BlueSnap\\" : "src/" | ||
} | ||
}, | ||
"require": { | ||
"omnipay/common": "~2.0" | ||
}, | ||
"require-dev": { | ||
"omnipay/tests": "~2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false"> | ||
<testsuites> | ||
<testsuite name="Omnipay Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<listeners> | ||
<listener class="Mockery\Adapter\Phpunit\TestListener" file="vendor/mockery/mockery/library/Mockery/Adapter/Phpunit/TestListener.php" /> | ||
</listeners> | ||
<filter> | ||
<whitelist> | ||
<directory>./src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
name="Psalm for BlueSnap Omnipay driver" | ||
stopOnFirstError="false" | ||
useDocblockTypes="true" | ||
strictBinaryOperands="true" | ||
totallyTyped="true" | ||
rememberPropertyAssignmentsAfterCall="false" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<directory name="tests" /> | ||
<directory name="psalm_plugins" /> | ||
</projectFiles> | ||
|
||
<fileExtensions> | ||
<extension name=".php" /> | ||
</fileExtensions> | ||
|
||
<plugins> | ||
<plugin filename="psalm_plugins/StringChecker.php" /> | ||
</plugins> | ||
|
||
<issueHandlers> | ||
<MissingConstructor> | ||
<errorLevel type="suppress"> | ||
<directory name="tests" /> | ||
</errorLevel> | ||
</MissingConstructor> | ||
<PropertyNotSetInConstructor errorLevel="suppress" /> | ||
</issueHandlers> | ||
|
||
<mockClasses> | ||
<class name="Mockery\MockInterface" /> | ||
</mockClasses> | ||
</psalm> |
Oops, something went wrong.