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

Added support for card payments via Payment::authorize with CSE #9

Open
wants to merge 5 commits into
base: v3
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "library",
"require": {
"omnipay/common": "~3",
"ext-json": "*"
"ext-json": "*",
"ext-openssl": "*"
},
"require-dev": {
"omnipay/tests": "~3",
Expand Down
40 changes: 40 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
namespace Omnipay\Paynl;

use Omnipay\Common\AbstractGateway;
use Omnipay\Paynl\Message\Request\AuthenticateRequest;
use Omnipay\Paynl\Message\Request\AuthorizeRequest;
use Omnipay\Paynl\Message\Request\CaptureRequest;
use Omnipay\Paynl\Message\Request\CompletePurchaseRequest;
use Omnipay\Paynl\Message\Request\FetchAuthenticationStatusRequest;
use Omnipay\Paynl\Message\Request\FetchEncryptionKeysRequest;
use Omnipay\Paynl\Message\Request\FetchIssuersRequest;
use Omnipay\Paynl\Message\Request\FetchPaymentMethodsRequest;
use Omnipay\Paynl\Message\Request\FetchTransactionRequest;
Expand Down Expand Up @@ -146,6 +150,15 @@ public function fetchTransaction(array $options = [])
return $this->createRequest(FetchTransactionRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|FetchTransactionRequest
*/
public function fetchAuthenticationStatus(array $options = [])
{
return $this->createRequest(FetchAuthenticationStatusRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|FetchPaymentMethodsRequest
Expand All @@ -156,6 +169,15 @@ public function fetchPaymentMethods(array $options = [])
return $this->createRequest(FetchPaymentMethodsRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest
*/
public function fetchEncryptionKeys(array $options = [])
{
return $this->createRequest(FetchEncryptionKeysRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|FetchIssuersRequest
Expand All @@ -175,6 +197,24 @@ public function purchase(array $options = array())
return $this->createRequest(PurchaseRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|AuthorizeRequest
*/
public function authorize(array $options = array())
{
return $this->createRequest(AuthorizeRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|AuthenticateRequest
*/
public function authenticate(array $options = array())
{
return $this->createRequest(AuthenticateRequest::class, $options);
}

/**
* @param array $options
* @return \Omnipay\Common\Message\AbstractRequest|VoidRequest
Expand Down
4 changes: 2 additions & 2 deletions src/Message/Request/AbstractPaynlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ abstract class AbstractPaynlRequest extends AbstractRequest
/**
* @var string
*/
private $baseUrl = 'https://rest-api.pay.nl';
private $version = '/v18/transaction/';
protected $baseUrl = 'https://rest-api.pay.nl';
protected $version = '/v18/transaction/';

/**
* @param string $endpoint
Expand Down
29 changes: 29 additions & 0 deletions src/Message/Request/AuthenticateRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Omnipay\Paynl\Message\Request;


use Omnipay\Common\CreditCard;
use Omnipay\Common\Item;
use Omnipay\Paynl\Message\Response\AuthenticateResponse;

/**
* Class AuthenticateRequest
* To start a payment authentication
* @package Omnipay\Paynl\Message\Request
*
* @method AuthenticateResponse send()
*/
class AuthenticateRequest extends AuthorizeRequest
{

/**
* @param array $data
* @return \Omnipay\Common\Message\ResponseInterface|PurchaseResponse
*/
public function sendData($data)
{
$responseData = $this->sendRequest('authenticate', $data);
return $this->response = new AuthenticateResponse($this, $responseData);
}
}
Loading