Skip to content
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

Updated code for Omnipay 3 #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

**BluePay driver for the Omnipay PHP payment processing library**

[![Build Status](https://travis-ci.org/zburke/omnipay-bluepay.png?branch=master)](https://travis-ci.org/zburke/omnipay-bluepay)
[![Build Status](https://travis-ci.org/emergingdzns/omnipay-bluepay.png?branch=master)](https://travis-ci.org/emergingdzns/omnipay-bluepay)

[Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements BluePay support for Omnipay.

This build is a fork of the package from https://github.com/zburke/omnipay-bluepay

## Installation

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it
Expand All @@ -15,7 +17,7 @@ to your `composer.json` file:
```json
{
"require": {
"zburke/omnipay-bluepay": "~1.0"
"emergingdzns/omnipay-bluepay": "~2.0"
}
}
```
Expand Down Expand Up @@ -44,5 +46,5 @@ If you want to keep up to date with release anouncements, discuss ideas for the
or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which
you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/zburke/omnipay-bluepay/issues),
If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/emergingdzns/omnipay-bluepay/issues),
or better yet, fork the library and submit a pull request.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "zburke/omnipay-bluepay",
"name": "emergingdzns/omnipay-bluepay",
"type": "library",
"description": "BluePay gateway for the Omnipay payment processing library",
"keywords": [
Expand All @@ -10,7 +10,7 @@
"pay",
"payment"
],
"homepage": "https://github.com/zburke/omnipay-bluepay",
"homepage": "https://github.com/emergingdzns/omnipay-bluepay",
"license": "MIT",
"authors": [
{
Expand All @@ -19,17 +19,17 @@
},
{
"name": "Omnipay Contributors",
"homepage": "https://github.com/zburke/omnipay-bluepay/contributors"
"homepage": "https://github.com/emergingdzns/omnipay-bluepay/contributors"
}
],
"autoload": {
"psr-4": { "Omnipay\\BluePay\\" : "src/" }
},
"require": {
"omnipay/common": "~2.0"
"omnipay/common": "~3"
},
"require-dev": {
"omnipay/tests": "~2.0"
"omnipay/tests": "~3"
},
"extra": {
"branch-alias": {
Expand Down
3 changes: 0 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<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>
Expand Down
4 changes: 4 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function getDefaultParameters()
);
}

public function setCard($value)
{
return $this->setParameter('card', $value);
}

public function getAccountId()
{
Expand Down
17 changes: 4 additions & 13 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Log;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log doesn't appear to be used anywhere. Can it be omitted here?

namespace Omnipay\BluePay\Message;

/**
Expand Down Expand Up @@ -35,7 +36,6 @@ public function setSecretKey($value)
return $this->setParameter('secretKey', $value);
}


public function getToken()
{
return $this->getParameter('token');
Expand Down Expand Up @@ -185,21 +185,12 @@ public function tps($data)

public function sendData($data)
{
// don't throw exceptions for 4xx errors
// cribbed from https://github.com/thephpleague/omnipay-stripe/blob/master/src/Message/AbstractRequest.php
// Fist add in my tamper-proof-seal
$data = array_merge($data, $this->tps($data));
$this->httpClient->getEventDispatcher()->addListener(
'request.error',
function ($event) {
if ($event['response']->isClientError()) {
$event->stopPropagation();
}
}
);

$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
return $this->response = new Response($this, $httpResponse->getBody());
$httpResponse = $this->httpClient->request('POST', $this->getEndpoint(), [], http_build_query($data));

return $this->response = new Response($this, $httpResponse->getBody()->getContents());
}


Expand Down
7 changes: 3 additions & 4 deletions src/Message/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ class RefundRequest extends AbstractRequest

public function getData()
{
$this->getCard()->validate();

$this->validate('transactionReference', 'amount');

$data = $this->getBaseData();
$data['PAYMENT_ACCOUNT'] = $this->getCard()->getNumber();
$data['CARD_EXPIRE'] = $this->getCard()->getExpiryDate('my');
$data['CARD_CVV2'] = $this->getCard()->getCvv();
$data['MASTER_ID'] = $this->getParameter('transactionReference');

return array_merge($data, $this->getBillingData());
}
Expand Down