Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mfauveau/omnipay-nmi
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: loadsys/omnipay-nmi
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 8 commits
  • 5 files changed
  • 2 contributors

Commits on Aug 16, 2018

  1. Copy the full SHA
    4a8c545 View commit details
  2. Merge pull request #1 from loadsys/b/customer-vault-order-data

    B/customer vault order data
    chronon authored Aug 16, 2018
    Copy the full SHA
    7960ce3 View commit details

Commits on May 19, 2020

  1. Add payment token support

    chronon committed May 19, 2020
    Copy the full SHA
    eb5f6da View commit details
  2. Merge pull request #2 from loadsys/f/collect-payment-token

    F/collect payment token
    chronon authored May 19, 2020
    Copy the full SHA
    496bfb8 View commit details

Commits on Sep 2, 2021

  1. Update for Omnipay 3.x

    chronon committed Sep 2, 2021
    Copy the full SHA
    bee341f View commit details

Commits on Sep 14, 2021

  1. Merge pull request #3 from loadsys/f/omnipay-v3

    F/omnipay v3
    chronon authored Sep 14, 2021
    Copy the full SHA
    85d3250 View commit details

Commits on Aug 30, 2023

  1. Copy the full SHA
    1f1dc1e View commit details
  2. Merge pull request #4 from loadsys/b/validate-method

    b/validate method
    chronon authored Aug 30, 2023
    Copy the full SHA
    8499786 View commit details
Showing with 33 additions and 17 deletions.
  1. +3 −3 composer.json
  2. +3 −3 src/DirectPostGateway.php
  3. +18 −3 src/Message/AbstractRequest.php
  4. +1 −3 src/Message/DirectPostAuthRequest.php
  5. +8 −5 src/Message/DirectPostCreateCardRequest.php
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -26,14 +26,14 @@
"psr-4": { "Omnipay\\NMI\\" : "src/" }
},
"require": {
"omnipay/common": "~2.0"
"league/omnipay": "^3.0"
},
"require-dev": {
"omnipay/tests": "~2.0"
"omnipay/tests": "^3.0"
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "3.0.x-dev"
}
}
}
6 changes: 3 additions & 3 deletions src/DirectPostGateway.php
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ public function credit(array $parameters = array())

/**
* @param array $parameters
* @return \Omnipay\NMI\Message\CreateCardRequest
* @return \Omnipay\NMI\Message\DirectPostCreateCardRequest
*/
public function createCard(array $parameters = array())
{
@@ -372,7 +372,7 @@ public function createCard(array $parameters = array())

/**
* @param array $parameters
* @return \Omnipay\NMI\Message\UpdateCardRequest
* @return \Omnipay\NMI\Message\DirectPostUpdateCardRequest
*/
public function updateCard(array $parameters = array())
{
@@ -381,7 +381,7 @@ public function updateCard(array $parameters = array())

/**
* @param array $parameters
* @return \Omnipay\NMI\Message\DeleteCardRequest
* @return \Omnipay\NMI\Message\DirectPostDeleteCardRequest
*/
public function deleteCard(array $parameters = array())
{
21 changes: 18 additions & 3 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
@@ -326,9 +326,14 @@ protected function getShippingData()

public function sendData($data)
{
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
$httpResponse = $this->httpClient->request(
'POST',
$this->getEndpoint(),
['Content-Type' => 'application/x-www-form-urlencoded'],
http_build_query($data)
);

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

public function setEndpoint($value)
@@ -338,6 +343,16 @@ public function setEndpoint($value)

public function getEndpoint()
{
return $this->endpoint;
return $this->getParameter('endpoint') ?: $this->endpoint;
}

public function getPaymentToken()
{
return $this->getParameter('payment_token');
}

public function setPaymentToken($value)
{
return $this->setParameter('payment_token', $value);
}
}
4 changes: 1 addition & 3 deletions src/Message/DirectPostAuthRequest.php
Original file line number Diff line number Diff line change
@@ -10,15 +10,13 @@ class DirectPostAuthRequest extends AbstractRequest

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

$data = $this->getBaseData();
$data['amount'] = $this->getAmount();

if ($this->getCardReference()) {
$data['customer_vault_id'] = $this->getCardReference();

return $data;
return array_merge($data, $this->getOrderData());
} else {
$this->getCard()->validate();

13 changes: 8 additions & 5 deletions src/Message/DirectPostCreateCardRequest.php
Original file line number Diff line number Diff line change
@@ -11,13 +11,16 @@ class DirectPostCreateCardRequest extends AbstractRequest

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

$this->validate('card');
$data = $this->getBaseData();

$data['ccnumber'] = $this->getCard()->getNumber();
$data['ccexp'] = $this->getCard()->getExpiryDate('my');
if ($paymentToken = $this->getPaymentToken()) {
$data['payment_token'] = $paymentToken;
} else {
$this->getCard()->validate();
$data['ccnumber'] = $this->getCard()->getNumber();
$data['ccexp'] = $this->getCard()->getExpiryDate('my');
}
$data['payment'] = 'creditcard';

if ('update_customer' === $this->customer_vault) {