From 4c206be99e3d82384d34a35612e3caee4f285812 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Thu, 9 May 2019 08:41:49 +0200 Subject: [PATCH 01/51] [cleanup] Remove whitespaces. --- example/CreditCardRegistration.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/example/CreditCardRegistration.php b/example/CreditCardRegistration.php index 6b271b9..995e9c6 100755 --- a/example/CreditCardRegistration.php +++ b/example/CreditCardRegistration.php @@ -118,7 +118,3 @@ - - - - \ No newline at end of file From e6f40b915d84dd70b0c2dcdb2685e7d3d56bea35 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Thu, 9 May 2019 08:44:19 +0200 Subject: [PATCH 02/51] [change] Apply micro optimizations. --- example/HeidelpayResponse.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/HeidelpayResponse.php b/example/HeidelpayResponse.php index 4b7b7ea..a32231b 100755 --- a/example/HeidelpayResponse.php +++ b/example/HeidelpayResponse.php @@ -19,7 +19,7 @@ * For security reason all examples are disabled by default. */ require_once './_enableExamples.php'; -if (defined('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES') and HEIDELPAY_PHP_PAYMENT_API_EXAMPLES !== true) { +if (defined('HEIDELPAY_PHP_PAYMENT_API_EXAMPLES') && HEIDELPAY_PHP_PAYMENT_API_EXAMPLES !== true) { exit(); } @@ -28,7 +28,7 @@ $HeidelpayResponse = new Heidelpay\PhpPaymentApi\Response($_POST); -$secretPass = "39542395235ßfsokkspreipsr"; +$secretPass = '39542395235ßfsokkspreipsr'; $identificationTransactionId = $HeidelpayResponse->getIdentification()->getTransactionId(); @@ -39,7 +39,7 @@ * miss configuration. So you can log $e->getMessage() for debugging.*/ return; } - + if ($HeidelpayResponse->isSuccess()) { /* save order and transaction result to your database */ From 9dab34eec351a2fb16fa3da2ecc46846eda95ef9 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Fri, 10 May 2019 12:08:37 +0200 Subject: [PATCH 03/51] [cleanup] Several micro optimizations. --- lib/Adapter/CurlAdapter.php | 2 +- lib/ParameterGroups/CompanyParameterGroup.php | 47 ++++++++++++------- .../BasicPaymentMethodTrait.php | 19 ++++---- lib/PaymentMethods/PaymentMethodInterface.php | 15 +++--- lib/Response.php | 18 +++---- .../PaymentMethods/EPSPaymentMethodTest.php | 6 ++- 6 files changed, 63 insertions(+), 44 deletions(-) mode change 100644 => 100755 lib/ParameterGroups/CompanyParameterGroup.php diff --git a/lib/Adapter/CurlAdapter.php b/lib/Adapter/CurlAdapter.php index 9de1e39..01331b0 100755 --- a/lib/Adapter/CurlAdapter.php +++ b/lib/Adapter/CurlAdapter.php @@ -73,7 +73,7 @@ public function sendPost($uri = null, $post = null) curl_close($request); - if (isset($error) and !empty($error)) { + if (isset($error) && !empty($error)) { $errorCode = (is_array($info) && array_key_exists('CURLINFO_HTTP_CODE', $info)) ? $info['CURLINFO_HTTP_CODE'] diff --git a/lib/ParameterGroups/CompanyParameterGroup.php b/lib/ParameterGroups/CompanyParameterGroup.php old mode 100644 new mode 100755 index c6e9432..e17a776 --- a/lib/ParameterGroups/CompanyParameterGroup.php +++ b/lib/ParameterGroups/CompanyParameterGroup.php @@ -66,18 +66,17 @@ class CompanyParameterGroup extends AbstractParameterGroup /** * Function to add an executive to the existing list * - * @param string $function - * @param string $salutation - * @param string $given - * @param string $family - * @param string $birthdate - * @param string $email - * @param string $phone - * @param HomeParameterGroup $home - * @param mixed $homeStreet - * @param mixed $homeZip - * @param mixed $homeCity - * @param mixed $homeCountry + * @param string $function + * @param string $salutation + * @param string $given + * @param string $family + * @param string $birthdate + * @param string $email + * @param string $phone + * @param mixed $homeStreet + * @param mixed $homeZip + * @param mixed $homeCity + * @param mixed $homeCountry * * @return CompanyParameterGroup */ @@ -133,9 +132,9 @@ public function getExecutive($index = null) if ($index !== null) { if (!is_bool($index) && isset($this->executive[$index])) { return $this->executive[$index]; - } else { - return null; } + + return null; } return $this->executive; @@ -145,6 +144,8 @@ public function getExecutive($index = null) * Setter for company executive * * @param array $executive + * + * @return CompanyParameterGroup */ public function setExecutive($executive) { @@ -169,6 +170,8 @@ public function getLocation() * Setter for company location * * @param LocationParameterGroup $location + * + * @return CompanyParameterGroup */ public function setLocation($location) { @@ -190,6 +193,8 @@ public function getCompanyname() * Setter for companyname * * @param string $companyname + * + * @return CompanyParameterGroup */ public function setCompanyname($companyname) { @@ -198,7 +203,7 @@ public function setCompanyname($companyname) } /** - * Company registrationtype getter + * Company registration type getter * * @return string | null */ @@ -208,9 +213,11 @@ public function getRegistrationtype() } /** - * Setter for company registrationtype + * Setter for company registration type * * @param string $registrationtype + * + * @return CompanyParameterGroup */ public function setRegistrationtype($registrationtype) { @@ -232,6 +239,8 @@ public function getCommercialregisternumber() * Setter for commercialregistrnumber * * @param string $commercialregisternumber + * + * @return CompanyParameterGroup */ public function setCommercialregisternumber($commercialregisternumber) { @@ -253,6 +262,8 @@ public function getVatid() * Setter for vatid * * @param string $vatid + * + * @return CompanyParameterGroup */ public function setVatid($vatid) { @@ -261,7 +272,7 @@ public function setVatid($vatid) } /** - * Commercialsector getter + * Commercial sector getter * * @return string | null */ @@ -274,6 +285,8 @@ public function getCommercialSector() * Setter commerialSector * * @param string $commercialSector + * + * @return CompanyParameterGroup */ public function setCommercialSector($commercialSector) { diff --git a/lib/PaymentMethods/BasicPaymentMethodTrait.php b/lib/PaymentMethods/BasicPaymentMethodTrait.php index 4f16cc3..c6ae8e2 100755 --- a/lib/PaymentMethods/BasicPaymentMethodTrait.php +++ b/lib/PaymentMethods/BasicPaymentMethodTrait.php @@ -6,7 +6,8 @@ use Heidelpay\PhpPaymentApi\Constants\ApiConfig; use Heidelpay\PhpPaymentApi\Constants\TransactionMode; use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; -use Heidelpay\PhpPaymentApi\Request as HeidelpayRequest; +use Heidelpay\PhpPaymentApi\Request; +use Heidelpay\PhpPaymentApi\Response; /** * This class is the basic payment method trait @@ -35,7 +36,7 @@ trait BasicPaymentMethodTrait /** * Heidelpay request object * - * @var \Heidelpay\PhpPaymentApi\Request + * @var Request */ protected $request; @@ -49,7 +50,7 @@ trait BasicPaymentMethodTrait /** * Heidelpay response object * - * @var \Heidelpay\PhpPaymentApi\Response + * @var Response */ protected $response; @@ -111,7 +112,7 @@ public static function getClassName() /** * @inheritdoc */ - public function setRequest(HeidelpayRequest $heidelpayRequest) + public function setRequest(Request $heidelpayRequest) { $this->request = $heidelpayRequest; } @@ -119,12 +120,12 @@ public function setRequest(HeidelpayRequest $heidelpayRequest) /** * Returns the Request instance. * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function getRequest() { if ($this->request === null) { - return $this->request = new HeidelpayRequest(); + return $this->request = new Request(); } return $this->request; @@ -133,7 +134,7 @@ public function getRequest() /** * Returns the Response instance. * - * @return \Heidelpay\PhpPaymentApi\Response + * @return Response */ public function getResponse() { @@ -143,7 +144,7 @@ public function getResponse() /** * Set a HTTP Adapter for payment communication * - * @param \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface $adapter + * @param HttpAdapterInterface $adapter */ public function setAdapter($adapter) { @@ -153,7 +154,7 @@ public function setAdapter($adapter) /** * Get HTTP Adapter for payment communication * - * @return \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface + * @return HttpAdapterInterface */ public function getAdapter() { diff --git a/lib/PaymentMethods/PaymentMethodInterface.php b/lib/PaymentMethods/PaymentMethodInterface.php index b092ff1..c2c631a 100755 --- a/lib/PaymentMethods/PaymentMethodInterface.php +++ b/lib/PaymentMethods/PaymentMethodInterface.php @@ -2,7 +2,10 @@ namespace Heidelpay\PhpPaymentApi\PaymentMethods; +use Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface; +use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; use Heidelpay\PhpPaymentApi\Request; +use Heidelpay\PhpPaymentApi\Response; use JsonSerializable; /** @@ -36,7 +39,7 @@ public function getBrand(); /** * Get url of the used payment api * - * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + * @throws UndefinedTransactionModeException * * @return boolean|string url of the payment api */ @@ -45,35 +48,35 @@ public function getPaymentUrl(); /** * Get HTTP Adapter for payment communication * - * @return \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface + * @return HttpAdapterInterface */ public function getAdapter(); /** * Returns the Request instance. * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function getRequest(); /** * Returns the Response instance. * - * @return \Heidelpay\PhpPaymentApi\Response + * @return Response */ public function getResponse(); /** * Set a HTTP Adapter for payment communication * - * @param \Heidelpay\PhpPaymentApi\Adapter\HttpAdapterInterface $adapter + * @param HttpAdapterInterface $adapter */ public function setAdapter($adapter); /** * Set a new payment request object * - * @param \Heidelpay\PhpPaymentApi\Request $heidelpayRequest + * @param Request $heidelpayRequest */ public function setRequest(Request $heidelpayRequest); diff --git a/lib/Response.php b/lib/Response.php index d9588d8..e6a8c1c 100755 --- a/lib/Response.php +++ b/lib/Response.php @@ -27,14 +27,14 @@ class Response extends AbstractMethod /** * ConnectorParameterGroup * - * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ConnectorParameterGroup + * @var ConnectorParameterGroup */ protected $connector; /** * ProcessingParameterGroup * - * @var \Heidelpay\PhpPaymentApi\ParameterGroups\ProcessingParameterGroup + * @var ProcessingParameterGroup */ protected $processing; @@ -54,7 +54,7 @@ public function __construct($rawResponse = null) /** * Processing getter * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\ProcessingParameterGroup + * @return ProcessingParameterGroup */ public function getProcessing() { @@ -68,7 +68,7 @@ public function getProcessing() /** * Connector getter * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\ConnectorParameterGroup + * @return ConnectorParameterGroup */ public function getConnector() { @@ -84,7 +84,7 @@ public function getConnector() * * @param array $rawResponse * - * @return \Heidelpay\PhpPaymentApi\Response + * @return Response * * @deprecated 1.3.0 Response::fromPost should be used to create an instance with POST parameters. */ @@ -95,7 +95,7 @@ public function splitArray($rawResponse) } /** - * Response was successfull + * Response was successful * * @return boolean */ @@ -138,9 +138,9 @@ public function getError() } /** - * Get payment reference id or uniqe id + * Get payment reference id or unique id * - * @return string payment uniqe id + * @return string payment unique id */ public function getPaymentReferenceId() { @@ -169,7 +169,7 @@ public function getPaymentFormUrl() throw new PaymentFormUrlException('The PaymentCode is not set.'); } - list($code, $type) = explode('.', $this->getPayment()->getCode()); + list($code,) = explode('.', $this->getPayment()->getCode()); if (($code === PaymentMethod::CREDIT_CARD || $code === PaymentMethod::DEBIT_CARD) && $this->getIdentification()->getReferenceId() === null diff --git a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index d1729f5..d8b01ad 100755 --- a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -2,6 +2,7 @@ namespace Heidelpay\Tests\PhpPaymentApi\Integration\PaymentMethods; +use Exception; use Heidelpay\PhpPaymentApi\Response; use Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod as EPS; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; @@ -29,6 +30,7 @@ class EPSPaymentMethodTest extends BasePaymentMethodTest * @var string currency */ protected $currency = 'EUR'; + /** * Secret * @@ -44,7 +46,7 @@ class EPSPaymentMethodTest extends BasePaymentMethodTest /** * PaymentObject * - * @var \Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod + * @var EPS */ protected $paymentObject; @@ -89,7 +91,7 @@ public function _before() * @return string payment reference id for the EPS authorize transaction * @group connectionTest * - * @throws \Exception + * @throws Exception */ public function testAuthorize() { From 1b0c3a22602b0870157a30c2366fb4deb8b53414 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Fri, 10 May 2019 14:13:39 +0200 Subject: [PATCH 04/51] [change] (PHPLIB-143) EPS: Add missing parameters for EPS without form. --- lib/AbstractMethod.php | 23 ++++-- .../ProcessingParameterGroup.php | 21 ++++++ .../RedirectParameterGroup.php | 65 +++++++++++++++++ .../PaymentMethods/EPSPaymentMethodTest.php | 35 +++++++++ .../PaymentMethods/EPSPaymentMethodTest.php | 73 +++++++++++++++++++ 5 files changed, 209 insertions(+), 8 deletions(-) create mode 100755 lib/ParameterGroups/RedirectParameterGroup.php create mode 100755 tests/unit/PaymentMethods/EPSPaymentMethodTest.php diff --git a/lib/AbstractMethod.php b/lib/AbstractMethod.php index ebd5420..85d0530 100755 --- a/lib/AbstractMethod.php +++ b/lib/AbstractMethod.php @@ -18,6 +18,7 @@ use Heidelpay\PhpPaymentApi\ParameterGroups\NameParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\PaymentParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\PresentationParameterGroup; +use Heidelpay\PhpPaymentApi\ParameterGroups\ProcessingParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\RequestParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\SecurityParameterGroup; use Heidelpay\PhpPaymentApi\ParameterGroups\TransactionParameterGroup; @@ -139,7 +140,7 @@ public function getBasket() /** * Company getter * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\CompanyParameterGroup + * @return CompanyParameterGroup */ public function getCompany() { @@ -193,7 +194,7 @@ public function getCriterion() } /** - * Frondend getter + * Frond end getter * * @return FrontendParameterGroup */ @@ -395,7 +396,7 @@ public function toArray($doSort = false) /** * Build an array for subParameterGroups like Company->location * - * @param mixed $requestParameter Is whether a parametergroup, array or string + * @param mixed $requestParameter Is whether a parameter group, array or string * @param $parentParameterName * * @return array @@ -496,7 +497,7 @@ protected function mapFromJson($json) } /** - * Maps subparametergroups of JSON object + * Maps sub parameter groups of JSON object * * @param AbstractParameterGroup $parameterGroup * @param string $propertyName @@ -505,7 +506,6 @@ protected function mapFromJson($json) protected function mapFromJsonSubGroups($parameterGroup, $propertyName, $content) { $getterFunction = 'get' . ucfirst($propertyName); - $addFunction = 'add' . ucfirst($propertyName); if (is_callable([$parameterGroup, $getterFunction])) { $subParameterGroup = $parameterGroup->{$getterFunction}(); @@ -518,12 +518,12 @@ protected function mapFromJsonSubGroups($parameterGroup, $propertyName, $content if (is_array($content)) { foreach ($content as $index => $value) { if ($index+1 > count($subParameterGroup)) { - $className = 'Heidelpay\PhpPaymentApi\ParameterGroups\\'.ucfirst($propertyName) . "ParameterGroup"; + $className = 'Heidelpay\PhpPaymentApi\ParameterGroups\\'.ucfirst($propertyName) . 'ParameterGroup'; $subParameterGroup[] = new $className(); $parameterGroup->set($propertyName, $subParameterGroup); } - if ($value == null) { + if ($value === null) { continue; } @@ -595,15 +595,22 @@ protected function mapSubGroupsFromPost($parameterGroup, $paramGroupProp, $value $parameterGroupGetterFunc = 'get' . ucfirst($paramGroupName); if ($paramGroupProp !== null && is_callable([$parameterGroup, $parameterGroupGetterFunc])) { $parameterGroup = $parameterGroup->{$parameterGroupGetterFunc}(); + if (is_array($parameterGroup)) { $parameterGroup = $paramGroupName; } $this->mapSubGroupsFromPost($parameterGroup, $paramGroupString, $value); } + if ($parameterGroup === 'parameter') { + /** @var ProcessingParameterGroup $processing */ + $processing = $this->getProcessing(); + $processing->getRedirect()->parameter[$paramGroupString] = $value; + } + //Handle executive parametergroup if (is_numeric($paramGroupName) && $parameterGroup === 'executive') { - if ((int)$paramGroupName > count(($this->getCompany()->executive))) { + if ((int)$paramGroupName > count($this->getCompany()->executive)) { $executives = $this->getCompany()->getExecutive(); $executives[] = new ExecutiveParameterGroup(); $this->getCompany()->setExecutive($executives); diff --git a/lib/ParameterGroups/ProcessingParameterGroup.php b/lib/ParameterGroups/ProcessingParameterGroup.php index 518432e..cc3d8d7 100755 --- a/lib/ParameterGroups/ProcessingParameterGroup.php +++ b/lib/ParameterGroups/ProcessingParameterGroup.php @@ -71,6 +71,19 @@ class ProcessingParameterGroup extends AbstractParameterGroup */ public $status_code; + /** + * @var RedirectParameterGroup $redirect + */ + public $redirect; + + /** + * ProcessingParameterGroup constructor. + */ + public function __construct() + { + $this->redirect = new RedirectParameterGroup(); + } + /** * ProcessingResult getter * @@ -110,4 +123,12 @@ public function getStatusCode() { return $this->status_code; } + + /** + * @return RedirectParameterGroup + */ + public function getRedirect() + { + return $this->redirect; + } } diff --git a/lib/ParameterGroups/RedirectParameterGroup.php b/lib/ParameterGroups/RedirectParameterGroup.php new file mode 100755 index 0000000..220b3ab --- /dev/null +++ b/lib/ParameterGroups/RedirectParameterGroup.php @@ -0,0 +1,65 @@ +parameter[$name] = $value; + } + + /** + * @return array + */ + public function getParameter() + { + return $this->parameter; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + * @return RedirectParameterGroup + */ + public function setUrl($url) + { + $this->url = $url; + return $this; + } +} diff --git a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index d8b01ad..fdbbda9 100755 --- a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -114,4 +114,39 @@ public function testAuthorize() return (string)$response->getPaymentReferenceId(); } + + /** + * Test case for a single EPS authorize + * + * @return string payment reference id for the EPS authorize transaction + * @group connectionTest + * + * @throws Exception + */ + public function testAuthorizeFrontendDisabled() + { + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); + $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); + $this->paymentObject->getRequest()->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php'); + + $this->paymentObject->getRequest()->getAccount()->setCountry('DE'); + $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + + $this->paymentObject->authorize(); + + /* prepare request and send it to payment api */ + $request = $this->paymentObject->getRequest()->toArray(); + /** @var Response $response */ + list($result, $response) = + $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + + $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); + $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->assertNotEmpty($response->getProcessing()->getRedirect()->url); + $this->assertNotEmpty($response->getProcessing()->getRedirect()->getParameter()); + + $this->logDataToDebug($result); + + return (string)$response->getPaymentReferenceId(); + } } diff --git a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php new file mode 100755 index 0000000..ded65a9 --- /dev/null +++ b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php @@ -0,0 +1,73 @@ +authentication->setTransactionChannel('31HA07BC8142C5A171744F3D6D155865'); + + $paymentObject = new EPSPaymentMethod(); + + $request = $paymentObject->getRequest(); + $request->authentification(...$this->authentication->getAuthenticationArray()); + $request->customerAddress(...$this->customerData->getCustomerDataArray()); + + $paymentObject->dryRun = false; + + $this->paymentObject = $paymentObject; + + $this->mockCurlAdapter(); + } + + /** + * Tear down function will remove all registered test doubles (i.e. Mocks) + */ + // @codingStandardsIgnoreStart + public function _after() + { + // @codingStandardsIgnoreEnd + $this->paymentObject = null; + test::clean(); + } + + /** + * @test + * + * @throws \PHPUnit\Framework\Exception + * @throws ExpectationFailedException + */ + public function requestPostArrayParamsShouldBeMappedAsExpected() + { + $url = 'https://this-is-a-test-redirect-url-for-eps-testing.de'; + $firstParam = 'This is the content of the first parameter'; + $secondParam = 'This is the content of the second parameter'; + $postResponse = [ + 'PROCESSING_REDIRECT_PARAMETER_FIRST' => $firstParam, + 'PROCESSING_REDIRECT_PARAMETER_SECOND' => $secondParam, + 'PROCESSING_REDIRECT_URL' => $url + ]; + + /** @var RedirectParameterGroup $redirect */ + $redirect = (new Response($postResponse))->getProcessing()->getRedirect(); + + $this->assertEquals($url, $redirect->getUrl()); + $this->assertEquals(['first' => $firstParam, 'second' => $secondParam], $redirect->getParameter()); + } +} From 60f354036579fba01a56bee2e5ac39ef247db761 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Mon, 13 May 2019 16:26:15 +0200 Subject: [PATCH 05/51] [change] (PHPLIB-143) EPS: Refactor eps tests. --- .../PaymentMethods/EPSPaymentMethodTest.php | 27 ++++++++++--------- .../PaymentMethods/EPSPaymentMethodTest.php | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index fdbbda9..abd7167 100755 --- a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -70,10 +70,10 @@ public function _before() { // @codingStandardsIgnoreEnd $authentication = $this->authentication - ->setSecuritySender('31HA07BC8124AD82A9E96D9A35FAFD2A') - ->setUserLogin('31ha07bc8124ad82a9e96d486d19edaa') - ->setUserPassword('password') - ->setTransactionChannel('31HA07BC812125981B4F52033DE486AB') + ->setSecuritySender('31HA07BC8142C5A171745D00AD63D182') + ->setUserLogin('31ha07bc8142c5a171744e5aef11ffd3') + ->setUserPassword('93167DE7') + ->setTransactionChannel('31HA07BC816492169CE30CFBBF83B1D5') ->getAuthenticationArray(); $customerDetails = $this->customerData->getCustomerDataArray(); @@ -109,6 +109,7 @@ public function testAuthorize() $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); + $this->assertEmpty($response->getProcessing()->getRedirect()->getUrl()); $this->logDataToDebug($result); @@ -125,25 +126,27 @@ public function testAuthorize() */ public function testAuthorizeFrontendDisabled() { + $request = $this->paymentObject->getRequest(); + $timestamp = $this->getMethod(__METHOD__) . ' ' . date('Y-m-d H:i:s'); - $this->paymentObject->getRequest()->basketData($timestamp, 23.12, $this->currency, $this->secret); - $this->paymentObject->getRequest()->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php'); + $request->basketData($timestamp, 23.12, $this->currency, $this->secret); + $request->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php'); - $this->paymentObject->getRequest()->getAccount()->setCountry('DE'); - $this->paymentObject->getRequest()->getFrontend()->setEnabled('FALSE'); + $request->getAccount()->setCountry('AT'); + $request->getFrontend()->setEnabled('FALSE'); $this->paymentObject->authorize(); /* prepare request and send it to payment api */ - $request = $this->paymentObject->getRequest()->toArray(); + $requestArray = $request->toArray(); /** @var Response $response */ - list($result, $response) = - $this->paymentObject->getRequest()->send($this->paymentObject->getPaymentUrl(), $request); + list($result, $response) = $request->send($this->paymentObject->getPaymentUrl(), $requestArray); $this->assertTrue($response->isSuccess(), 'Transaction failed : ' . print_r($response, 1)); $this->assertFalse($response->isError(), 'authorize failed : ' . print_r($response->getError(), 1)); $this->assertNotEmpty($response->getProcessing()->getRedirect()->url); - $this->assertNotEmpty($response->getProcessing()->getRedirect()->getParameter()); + // Unfortunately this can only be tested in live mode + //$this->assertNotEmpty($response->getProcessing()->getRedirect()->getParameter()); $this->logDataToDebug($result); diff --git a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php index ded65a9..a014285 100755 --- a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php @@ -53,7 +53,7 @@ public function _after() * @throws \PHPUnit\Framework\Exception * @throws ExpectationFailedException */ - public function requestPostArrayParamsShouldBeMappedAsExpected() + public function responsePostArrayParamsShouldBeMappedAsExpected() { $url = 'https://this-is-a-test-redirect-url-for-eps-testing.de'; $firstParam = 'This is the content of the first parameter'; From 009c5ce6568bdabe97496f1bf2a35fe05cb10853 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Mon, 13 May 2019 17:05:13 +0200 Subject: [PATCH 06/51] [change] (PHPLIB-143) EPS: Fix setting processing redirect parameter group. --- lib/AbstractMethod.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/AbstractMethod.php b/lib/AbstractMethod.php index 85d0530..fe02c2e 100755 --- a/lib/AbstractMethod.php +++ b/lib/AbstractMethod.php @@ -602,13 +602,13 @@ protected function mapSubGroupsFromPost($parameterGroup, $paramGroupProp, $value $this->mapSubGroupsFromPost($parameterGroup, $paramGroupString, $value); } - if ($parameterGroup === 'parameter') { + if ($paramGroupName === 'parameter') { /** @var ProcessingParameterGroup $processing */ $processing = $this->getProcessing(); $processing->getRedirect()->parameter[$paramGroupString] = $value; } - //Handle executive parametergroup + // handle executive parameter group if (is_numeric($paramGroupName) && $parameterGroup === 'executive') { if ((int)$paramGroupName > count($this->getCompany()->executive)) { $executives = $this->getCompany()->getExecutive(); From c48b19d29c3e2ff6a188ab2075dbc974180e96f3 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Mon, 13 May 2019 17:26:05 +0200 Subject: [PATCH 07/51] [change] (PHPLIB-143) EPS: Add example for eps implementation without bank selection in shop. --- example/EpsAuthorizeWithoutForm.php | 135 ++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 example/EpsAuthorizeWithoutForm.php diff --git a/example/EpsAuthorizeWithoutForm.php b/example/EpsAuthorizeWithoutForm.php new file mode 100644 index 0000000..3a96831 --- /dev/null +++ b/example/EpsAuthorizeWithoutForm.php @@ -0,0 +1,135 @@ +getRequest(); + +/** + * Set up your authentication data for heidelpay api + * + * @link https://dev.heidelpay.com/testumgebung/#Authentifizierungsdaten + */ +$epsRequest->authentification( + '31HA07BC8142C5A171745D00AD63D182', // SecuritySender + '31ha07bc8142c5a171744e5aef11ffd3', // UserLogin + '93167DE7', // UserPassword + '31HA07BC816492169CE30CFBBF83B1D5', // TransactionChannel credit card without 3d secure + true // enable/disable sandbox mode +); + +$epsRequest->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php'); + +// set up customer information required for risk checks +$epsRequest->customerAddress( + 'Hans', // Given name + 'Zimmer', // Family name + null, // Company Name + '12344', // Customer id of your application + 'Salzachstraße 13', // Billing address street + '', + '1200', // Billing address post code + 'Wien', // Billing address city + 'AT', // Billing address country code + 'support@heidelpay.com' // Customer mail address + ); + +// set up basket or transaction information +$epsRequest->basketData( + '2843294932', // Reference Id of your application + 23.12, // Amount of this request + 'EUR', // Currency code of this request + '39542395235ßfsokkspreipsr' // A secret passphrase from your application + ); + +// set bank country +$epsRequest->getAccount()->setCountry('AT'); + +// disable frontend mode -> this shows that there is no additional input necessary by the customer prior to the redirect to the eps page. +$epsRequest->getFrontend()->setEnabled('FALSE'); + +// perform the authorize transaction to retrieve the redirect url and parameters +$eps->authorize(); + +// get the redirect url and necessary parameters from the response. +$redirectParameters = $eps->getResponse()->getProcessing()->getRedirect(); +$redirectUrl = $redirectParameters->getUrl(); +$redirectParams = $redirectParameters->getParameter(); + +echo 'RedirectUrl: ' . $redirectUrl; +ksort($redirectParams); +foreach($redirectParams as $key=>$value) { + echo '
RedirectParam ' . $key . ': ' . $value; +} + +/** + * Attention: + * Unfortunately Sandbox-mode and Live-mode have to be handled differently. + * In case of .. + * 1. .. a sandbox transaction no redirect parameters exist and you have to perform a GET-Redirect to the redirect url. + * 2. .. a live mode transaction there will be redirect parameters and you have to submit them via POST-request to the redirect url. + * + * The following example shows one possible solution to this task. + */ +?> + + + + EPS authorize example + + + + +
+ $param) { + echo ''; + } + ?> + +
+ + + + From 818464b001cae0383c9344d3327666425944ca9f Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 08:23:50 +0200 Subject: [PATCH 08/51] [cleanup] (PHPLIB-143) Fix code style issues. --- lib/ParameterGroups/RedirectParameterGroup.php | 1 + lib/Response.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ParameterGroups/RedirectParameterGroup.php b/lib/ParameterGroups/RedirectParameterGroup.php index 220b3ab..10a5265 100755 --- a/lib/ParameterGroups/RedirectParameterGroup.php +++ b/lib/ParameterGroups/RedirectParameterGroup.php @@ -55,6 +55,7 @@ public function getUrl() /** * @param string $url + * * @return RedirectParameterGroup */ public function setUrl($url) diff --git a/lib/Response.php b/lib/Response.php index e6a8c1c..a184b29 100755 --- a/lib/Response.php +++ b/lib/Response.php @@ -169,7 +169,7 @@ public function getPaymentFormUrl() throw new PaymentFormUrlException('The PaymentCode is not set.'); } - list($code,) = explode('.', $this->getPayment()->getCode()); + list($code, ) = explode('.', $this->getPayment()->getCode()); if (($code === PaymentMethod::CREDIT_CARD || $code === PaymentMethod::DEBIT_CARD) && $this->getIdentification()->getReferenceId() === null From 52285e684cb82f6a7fc889081376d9e646b3ed4c Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 09:06:25 +0200 Subject: [PATCH 09/51] [cleanup] Fix code style issues. --- .../PaymentMethods/DummyPaymentMethod.php | 21 ++++++++++ .../GenericPaymentMethodTest.php | 39 +++++++++---------- 2 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 tests/unit/PaymentMethods/DummyPaymentMethod.php diff --git a/tests/unit/PaymentMethods/DummyPaymentMethod.php b/tests/unit/PaymentMethods/DummyPaymentMethod.php new file mode 100644 index 0000000..dc34f25 --- /dev/null +++ b/tests/unit/PaymentMethods/DummyPaymentMethod.php @@ -0,0 +1,21 @@ + + * + * @package Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods + */ +namespace Heidelpay\Tests\PhpPaymentApi\unit\PaymentMethods; + +use Heidelpay\PhpPaymentApi\PaymentMethods\BasicPaymentMethodTrait; + +class DummyPaymentMethod +{ + use BasicPaymentMethodTrait; +} diff --git a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php index e58a8a5..06d229f 100755 --- a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php @@ -1,13 +1,4 @@ assertArrayHasKey('PAYMENT.CODE', $requestArray); $this->assertSame($paymentCode . '.' . TransactionType::REFUND, $requestArray['PAYMENT.CODE']); $this->assertSame($paymentMethodClass, $requestArray['CRITERION.PAYMENT_METHOD']); - if (null !== $brand) { + if ($brand !== null) { $this->assertArrayHasKey('ACCOUNT.BRAND', $requestArray); $this->assertSame($brand, $requestArray['ACCOUNT.BRAND']); } else { @@ -158,6 +165,8 @@ public function verifyPaymentMethodPresentsAsExpected($paymentMethodClass, $paym * Verify getPaymentCode returns null if the property 'paymentCode' does not exist. * * @test + * + * @throws ExpectationFailedException */ public function basicPaymentMethodTraitShouldReturnNullWhenAPropertyIsNotDefined() { @@ -167,13 +176,3 @@ public function basicPaymentMethodTraitShouldReturnNullWhenAPropertyIsNotDefined // } - -/** - * This class is used to test the perform trait test. - * - * @package Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods - */ -class DummyPaymentMethod -{ - use BasicPaymentMethodTrait; -} From 8cf5a7b90559005bb8a208850c45175d726c770c Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 09:27:07 +0200 Subject: [PATCH 10/51] [cleanup] Fix newly introduced unit test error. --- .../PaymentMethods/DummyPaymentMethod.php | 21 ------------------- .../GenericPaymentMethodTest.php | 12 +++++++++++ 2 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 tests/unit/PaymentMethods/DummyPaymentMethod.php diff --git a/tests/unit/PaymentMethods/DummyPaymentMethod.php b/tests/unit/PaymentMethods/DummyPaymentMethod.php deleted file mode 100644 index dc34f25..0000000 --- a/tests/unit/PaymentMethods/DummyPaymentMethod.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * @package Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods - */ -namespace Heidelpay\Tests\PhpPaymentApi\unit\PaymentMethods; - -use Heidelpay\PhpPaymentApi\PaymentMethods\BasicPaymentMethodTrait; - -class DummyPaymentMethod -{ - use BasicPaymentMethodTrait; -} diff --git a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php index 06d229f..a75480b 100755 --- a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php @@ -20,6 +20,7 @@ use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\Constants\TransactionType; use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; +use Heidelpay\PhpPaymentApi\PaymentMethods\BasicPaymentMethodTrait; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; use PHPUnit\Framework\Exception as PhpUnitException; use PHPUnit\Framework\ExpectationFailedException; @@ -176,3 +177,14 @@ public function basicPaymentMethodTraitShouldReturnNullWhenAPropertyIsNotDefined // } + +/** + * This class is used to test the perform trait test. + * + * @package Heidelpay\Tests\PhpPaymentApi\Unit\PaymentMethods + */ +class DummyPaymentMethod +{ + use BasicPaymentMethodTrait; +} + From fc420517f59172e0c43d9672ec8c62245eb5c27e Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 09:39:38 +0200 Subject: [PATCH 11/51] [cleanup] Fix code style issues. --- tests/unit/PaymentMethods/EPSPaymentMethodTest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php index a014285..862213f 100755 --- a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php @@ -8,10 +8,13 @@ use Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod; use Heidelpay\PhpPaymentApi\Response; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; +use PHPUnit\Framework\Exception as PhpUnitException; use PHPUnit\Framework\ExpectationFailedException; class EPSPaymentMethodTest extends BasePaymentMethodTest { + + // /** * Set up function will create a payment method object for each test case * @@ -47,10 +50,14 @@ public function _after() test::clean(); } + // + + // + /** * @test * - * @throws \PHPUnit\Framework\Exception + * @throws PhpUnitException * @throws ExpectationFailedException */ public function responsePostArrayParamsShouldBeMappedAsExpected() @@ -70,4 +77,6 @@ public function responsePostArrayParamsShouldBeMappedAsExpected() $this->assertEquals($url, $redirect->getUrl()); $this->assertEquals(['first' => $firstParam, 'second' => $secondParam], $redirect->getParameter()); } + + // } From 492bff7e1c404d41078a8b2889b3a9d1f93d8fd9 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 09:41:47 +0200 Subject: [PATCH 12/51] [cleanup] Fix code style issues. --- tests/unit/PaymentMethods/EPSPaymentMethodTest.php | 1 - tests/unit/PaymentMethods/GenericPaymentMethodTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php index 862213f..b90c332 100755 --- a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php @@ -13,7 +13,6 @@ class EPSPaymentMethodTest extends BasePaymentMethodTest { - // /** * Set up function will create a payment method object for each test case diff --git a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php index a75480b..015b170 100755 --- a/tests/unit/PaymentMethods/GenericPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/GenericPaymentMethodTest.php @@ -187,4 +187,3 @@ class DummyPaymentMethod { use BasicPaymentMethodTrait; } - From d2b1e868e0c7d0d59fe14f4e7cff3258e554ce52 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 11:38:54 +0200 Subject: [PATCH 13/51] [cleanup] (PHPLIB-143) EPS: Optimized variable name. --- example/EpsAuthorizeWithoutForm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/EpsAuthorizeWithoutForm.php b/example/EpsAuthorizeWithoutForm.php index 3a96831..40e0968 100644 --- a/example/EpsAuthorizeWithoutForm.php +++ b/example/EpsAuthorizeWithoutForm.php @@ -78,9 +78,9 @@ $eps->authorize(); // get the redirect url and necessary parameters from the response. -$redirectParameters = $eps->getResponse()->getProcessing()->getRedirect(); -$redirectUrl = $redirectParameters->getUrl(); -$redirectParams = $redirectParameters->getParameter(); +$redirectGroup = $eps->getResponse()->getProcessing()->getRedirect(); +$redirectUrl = $redirectGroup->getUrl(); +$redirectParams = $redirectGroup->getParameter(); echo 'RedirectUrl: ' . $redirectUrl; ksort($redirectParams); From 86cf9d698c6a68a1d43470683b67e0ddec51f155 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 11:43:59 +0200 Subject: [PATCH 14/51] [cleanup] (PHPLIB-143) EPS: Optimized variable name. --- example/EpsAuthorizeWithoutForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/EpsAuthorizeWithoutForm.php b/example/EpsAuthorizeWithoutForm.php index 40e0968..479fef7 100644 --- a/example/EpsAuthorizeWithoutForm.php +++ b/example/EpsAuthorizeWithoutForm.php @@ -121,8 +121,8 @@ event.preventDefault(); // get the number ob redirect parameters - var inputCount = form.getElementsByTagName('input').length; - if (inputCount === 0) { + var redirectParameterCount = form.getElementsByTagName('input').length; + if (redirectParameterCount === 0) { // ... perform a get redirect if there are no parameters needed for the redirect ==> Sandbox mode window.location.href = form.getAttribute('action'); } else { From ad008cbd2453f427188090ead6b4d31b00ba35a0 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 11:51:11 +0200 Subject: [PATCH 15/51] [cleanup] Fix style issues. --- lib/Request.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Request.php b/lib/Request.php index c425f0f..26caa84 100755 --- a/lib/Request.php +++ b/lib/Request.php @@ -44,7 +44,7 @@ public function __construct() * @param string $transactionChannel channel id of the payment method, e.g. 31HA07BC8142C5A171744F3D6D155865 * @param bool $sandboxRequest choose between sandbox and productive payment system * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function authentification( $securitySender = null, @@ -71,7 +71,7 @@ public function authentification( * @param string $languageCode language code 2 letters for error messages and iframe, e.g. EN * @param string $responseUrl response url of your application, e.g. https://www.url.com/response.php * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function async($languageCode = 'EN', $responseUrl = null) { @@ -142,7 +142,7 @@ public function company( * @param string $addressCountry address country code 2 letters, e.g. DE * @param string $contactMail email address of the customer, e.g. ab@mail.de * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function customerAddress( $nameGiven = null, @@ -173,7 +173,6 @@ public function customerAddress( /** * @param string $shopperId * @param string $invoiceId - * @param string $reversaltype string $reversaltype "CANCLE, RETURN or CREDIT" */ public function factoring($invoiceId, $shopperId = null) { @@ -191,7 +190,7 @@ public function factoring($invoiceId, $shopperId = null) * @param string $currency currency code 3 letters, e.g. USD * @param string $secret a secret to prevent your application against fake responses * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function basketData($shopIdentifier = null, $amount = null, $currency = null, $secret = null) { @@ -244,7 +243,7 @@ public function send($uri = null, $post = null, $adapter = null) * @param string $birthdate customer birth date YYYY-MM-DD (Mandatory) * @param string $basketId id of a given basket using heidelpay basket api (Optional) * - * @return \Heidelpay\PhpPaymentApi\Request + * @return Request */ public function b2cSecured($salutation = null, $birthdate = null, $basketId = null) { From a566d29dc3f0ae874ce13401c14d2028c6ef4810 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 13:55:17 +0200 Subject: [PATCH 16/51] [cleanup] (PHPLIB-143) EPS: Avoid setting parameters outside redirect group. --- lib/AbstractMethod.php | 7 ++++--- tests/unit/PaymentMethods/EPSPaymentMethodTest.php | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/AbstractMethod.php b/lib/AbstractMethod.php index fe02c2e..4d6f8f5 100755 --- a/lib/AbstractMethod.php +++ b/lib/AbstractMethod.php @@ -579,8 +579,9 @@ protected function mapFromPost(array $post) * @param mixed $parameterGroup * @param string $paramGroupProp * @param string $value + * @param string $parentGroup */ - protected function mapSubGroupsFromPost($parameterGroup, $paramGroupProp, $value) + protected function mapSubGroupsFromPost($parameterGroup, $paramGroupProp, $value, $parentGroup = '') { $values = explode('_', strtolower($paramGroupProp), 2); @@ -599,10 +600,10 @@ protected function mapSubGroupsFromPost($parameterGroup, $paramGroupProp, $value if (is_array($parameterGroup)) { $parameterGroup = $paramGroupName; } - $this->mapSubGroupsFromPost($parameterGroup, $paramGroupString, $value); + $this->mapSubGroupsFromPost($parameterGroup, $paramGroupString, $value, $paramGroupName); } - if ($paramGroupName === 'parameter') { + if ($parentGroup === 'redirect' && $paramGroupName === 'parameter') { /** @var ProcessingParameterGroup $processing */ $processing = $this->getProcessing(); $processing->getRedirect()->parameter[$paramGroupString] = $value; diff --git a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php index b90c332..c480cc1 100755 --- a/tests/unit/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/unit/PaymentMethods/EPSPaymentMethodTest.php @@ -64,10 +64,12 @@ public function responsePostArrayParamsShouldBeMappedAsExpected() $url = 'https://this-is-a-test-redirect-url-for-eps-testing.de'; $firstParam = 'This is the content of the first parameter'; $secondParam = 'This is the content of the second parameter'; + $thirdParam = 'This is the content of a third parameter, which is not to be processed since it is not in the redirect group.'; $postResponse = [ 'PROCESSING_REDIRECT_PARAMETER_FIRST' => $firstParam, 'PROCESSING_REDIRECT_PARAMETER_SECOND' => $secondParam, - 'PROCESSING_REDIRECT_URL' => $url + 'PROCESSING_REDIRECT_URL' => $url, + 'PROCESSING_PARAMETER_THIRD' => $thirdParam ]; /** @var RedirectParameterGroup $redirect */ From 24b357b25ad52df0a10a6309d2d25b9a5e5e2b29 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 14:31:23 +0200 Subject: [PATCH 17/51] [cleanup] Fix typo. --- lib/AbstractMethod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AbstractMethod.php b/lib/AbstractMethod.php index 4d6f8f5..7dc5f7a 100755 --- a/lib/AbstractMethod.php +++ b/lib/AbstractMethod.php @@ -194,7 +194,7 @@ public function getCriterion() } /** - * Frond end getter + * Frontend getter * * @return FrontendParameterGroup */ From 420f31515655437893ead9636ac8edeb78554be8 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 14:32:05 +0200 Subject: [PATCH 18/51] [cleanup] Fix style issues. --- ...SantanderHirePurchasePaymentMethodTest.php | 12 +++- .../SantanderInvoicePaymentMethodTest.php | 62 ++++++++++--------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/tests/integration/PaymentMethods/SantanderHirePurchasePaymentMethodTest.php b/tests/integration/PaymentMethods/SantanderHirePurchasePaymentMethodTest.php index ac4c20f..5e33dbf 100755 --- a/tests/integration/PaymentMethods/SantanderHirePurchasePaymentMethodTest.php +++ b/tests/integration/PaymentMethods/SantanderHirePurchasePaymentMethodTest.php @@ -2,8 +2,12 @@ namespace Heidelpay\Tests\PhpPaymentApi\Integration\PaymentMethods; +use Exception; +use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; use Heidelpay\PhpPaymentApi\PaymentMethods\SantanderHirePurchasePaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\ExpectationFailedException; /** * Santander hire purchase Tests @@ -41,7 +45,7 @@ class SantanderHirePurchasePaymentMethodTest extends BasePaymentMethodTest /** * PaymentObject * - * @var \Heidelpay\PhpPaymentApi\PaymentMethods\SantanderHirePurchasePaymentMethod + * @var SantanderHirePurchasePaymentMethod */ protected $paymentObject; @@ -59,7 +63,7 @@ public function __construct() * * @see PHPUnit_Framework_TestCase::setUp() * - * @throws \Exception + * @throws Exception */ // @codingStandardsIgnoreStart public function _before() @@ -97,7 +101,9 @@ public function _before() /** * @test * - * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException + * @throws UndefinedTransactionModeException + * @throws AssertionFailedError + * @throws ExpectationFailedException */ public function initialRequest() { diff --git a/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php b/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php index c6ba1f1..246adb7 100755 --- a/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php +++ b/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php @@ -2,13 +2,22 @@ namespace Heidelpay\Tests\PhpPaymentApi\Integration\PaymentMethods; +use Heidelpay\PhpBasketApi\Exception\BasketException; +use Heidelpay\PhpBasketApi\Exception\CurlAdapterException; +use Heidelpay\PhpBasketApi\Exception\InvalidBasketitemPositionException; +use Heidelpay\PhpBasketApi\Exception\ParameterOverflowException; use Heidelpay\PhpBasketApi\Request as BasketRequest; use Heidelpay\PhpBasketApi\Response as BasketResponse; use Heidelpay\PhpBasketApi\Object\BasketItem; use Heidelpay\PhpPaymentApi\Constants\PaymentMethod; use Heidelpay\PhpPaymentApi\Constants\TransactionType; +use Heidelpay\PhpPaymentApi\Exceptions\HashVerificationException; +use Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException; use Heidelpay\PhpPaymentApi\PaymentMethods\SantanderInvoicePaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; +use PHPUnit\Framework\AssertionFailedError; +use PHPUnit\Framework\Exception; +use PHPUnit\Framework\ExpectationFailedException; /** * Invoice B2C secured Test @@ -27,34 +36,21 @@ */ class SantanderInvoicePaymentMethodTest extends BasePaymentMethodTest { - /** - * Transaction currency - * - * @var string currency - */ + /** @var string $currency */ protected $currency = 'EUR'; + /** - * Secret + * The secret will be used to generate a hash using transaction id + secret. This hash can be used to verify + * the payment response. Can be used for brute force protection. * - * The secret will be used to generate a hash using - * transaction id + secret. This hash can be used to - * verify the the payment response. Can be used for - * brute force protection. - * - * @var string secret + * @var string $secret */ protected $secret = 'Heidelpay-PhpPaymentApi'; - /** - * PaymentObject - * - * @var SantanderInvoicePaymentMethod - */ + /** @var SantanderInvoicePaymentMethod $paymentObject */ protected $paymentObject; - /** - * @var string $authorizeReference - */ + /** @var string $authorizeReference */ protected $authorizeReference; /** @@ -175,14 +171,20 @@ public function reversal($referenceId) /** * Test case for a invoice finalize of a existing authorisation * - * @param $referenceId string payment reference id of the invoice authorisation - * * @return string payment reference id for the prepayment reversal transaction + * + * @throws BasketException + * @throws CurlAdapterException + * @throws InvalidBasketitemPositionException + * @throws ParameterOverflowException + * @throws HashVerificationException + * @throws UndefinedTransactionModeException + * @throws AssertionFailedError + * @throws \Exception * @group connectionTest * * @test * - * @throws \Exception */ public function finalize() { @@ -220,12 +222,14 @@ public function finalize() * * @param string $referenceId reference id of the invoice to refund * + * @throws UndefinedTransactionModeException + * @throws Exception + * @throws ExpectationFailedException * @depends finalize * @test * * @group connectionTest * - * @throws \Heidelpay\PhpPaymentApi\Exceptions\UndefinedTransactionModeException */ public function refund($referenceId = null) { @@ -248,11 +252,11 @@ public function refund($referenceId = null) /** * @return string * - * @throws \Heidelpay\PhpBasketApi\Exception\BasketException - * @throws \Heidelpay\PhpBasketApi\Exception\CurlAdapterException - * @throws \Heidelpay\PhpBasketApi\Exception\InvalidBasketitemPositionException - * @throws \Heidelpay\PhpBasketApi\Exception\ParameterOverflowException - * @throws \PHPUnit\Framework\AssertionFailedError + * @throws BasketException + * @throws CurlAdapterException + * @throws InvalidBasketitemPositionException + * @throws ParameterOverflowException + * @throws AssertionFailedError */ public function createTestBasket() { From 759e24931141957079d7a0b595678bcc0a5d2f6a Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 14:55:06 +0200 Subject: [PATCH 19/51] [cleanup] Fix code style issues. --- .../FrontendParameterGroup.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/ParameterGroups/FrontendParameterGroup.php b/lib/ParameterGroups/FrontendParameterGroup.php index 7ed8e43..b584167 100755 --- a/lib/ParameterGroups/FrontendParameterGroup.php +++ b/lib/ParameterGroups/FrontendParameterGroup.php @@ -42,7 +42,7 @@ class FrontendParameterGroup extends AbstractParameterGroup /** * FrontendMode * - * @var string always set to withelabel on ngw (mandatory) + * @var string always set to whitelabel on ngw (mandatory) */ public $mode = FrontendMode::FRONTEND_MODE_WHITELABEL; @@ -168,7 +168,7 @@ public function getCssPath() } /** - * FrontendReventAsyncRedirect + * FrontendPreventAsyncRedirect * * @return boolean weather is enabled or not */ @@ -186,7 +186,7 @@ public function getPreventAsyncRedirect() * * @param string $css_path url to a css file, e.g. http://dev.heidelpay.com/heidelpay_iframe.css * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup */ public function setCssPath($css_path) { @@ -203,7 +203,7 @@ public function setCssPath($css_path) * * @param string $enabled 'FALSE' or 'TRUE' * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup */ public function setEnabled($enabled) { @@ -218,7 +218,7 @@ public function setEnabled($enabled) * * @param string $language iso language code 2 letters * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup */ public function setLanguage($language) { @@ -231,9 +231,9 @@ public function setLanguage($language) * * @param string $mode * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup * - * @deprecated Change of the mode propertie is prohibited since ngw-api needs WHITELABLE mode. + * @deprecated Change of the mode property is prohibited since ngw-api needs WHITELABEL mode. */ public function setMode($mode) { @@ -243,12 +243,12 @@ public function setMode($mode) /** * Setter for payment frame origin * - * for the credit and debit card iframe you have to set the source of the javascipt + * for the credit and debit card iframe you have to set the source of the javascript * post request., e.g. http://dev.heidelpay.com * * @param string $payment_frame_origin, e.g. http://dev.heidelpay.com * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup */ public function setPaymentFrameOrigin($payment_frame_origin) { @@ -265,7 +265,7 @@ public function setPaymentFrameOrigin($payment_frame_origin) * * @param string $prevent_async_redirect * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup */ public function setPreventAsyncRedirect($prevent_async_redirect) { @@ -285,7 +285,7 @@ public function setPreventAsyncRedirect($prevent_async_redirect) * * @param string $response_url, e.g. http://dev.heidelpay.com/reponse.php * - * @return \Heidelpay\PhpPaymentApi\ParameterGroups\FrontendParameterGroup + * @return FrontendParameterGroup * */ public function setResponseUrl($response_url) From 709b05758934127603c2a70a7a249398d64dae7c Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 15:02:50 +0200 Subject: [PATCH 20/51] [change] Optimize code. --- .../ProcessingParameterGroup.php | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/ParameterGroups/ProcessingParameterGroup.php b/lib/ParameterGroups/ProcessingParameterGroup.php index cc3d8d7..35d9eb8 100755 --- a/lib/ParameterGroups/ProcessingParameterGroup.php +++ b/lib/ParameterGroups/ProcessingParameterGroup.php @@ -37,12 +37,12 @@ class ProcessingParameterGroup extends AbstractParameterGroup public $result; /** - * @var string reson_code transaction result + * @var string reason_code transaction result */ public $reason_code; /** - * @var string reson transaction result + * @var string reason transaction result */ public $reason; @@ -76,14 +76,6 @@ class ProcessingParameterGroup extends AbstractParameterGroup */ public $redirect; - /** - * ProcessingParameterGroup constructor. - */ - public function __construct() - { - $this->redirect = new RedirectParameterGroup(); - } - /** * ProcessingResult getter * @@ -95,7 +87,7 @@ public function getResult() } /** - * ProcessingRetrun message getter + * ProcessingReturn message getter * * @return string return */ @@ -105,7 +97,7 @@ public function getReturn() } /** - * ProcessingRetrun code getter + * ProcessingReturn code getter * * @return string return code */ @@ -129,6 +121,10 @@ public function getStatusCode() */ public function getRedirect() { + if (!$this->redirect instanceof RedirectParameterGroup) { + $this->redirect = new RedirectParameterGroup(); + } + return $this->redirect; } } From 3e56cc0bc27e84ccd9e6940fdfe5e74ebc2b1461 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 15:08:38 +0200 Subject: [PATCH 21/51] [cleanup] (PHPLIB-143) EPS: Remove superfluous alias. --- tests/integration/PaymentMethods/EPSPaymentMethodTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index abd7167..17127ce 100755 --- a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -4,7 +4,7 @@ use Exception; use Heidelpay\PhpPaymentApi\Response; -use Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod as EPS; +use Heidelpay\PhpPaymentApi\PaymentMethods\EPSPaymentMethod; use Heidelpay\Tests\PhpPaymentApi\Helper\BasePaymentMethodTest; /** @@ -46,7 +46,7 @@ class EPSPaymentMethodTest extends BasePaymentMethodTest /** * PaymentObject * - * @var EPS + * @var EPSPaymentMethod */ protected $paymentObject; @@ -77,7 +77,7 @@ public function _before() ->getAuthenticationArray(); $customerDetails = $this->customerData->getCustomerDataArray(); - $EPS = new EPS(); + $EPS = new EPSPaymentMethod(); $EPS->getRequest()->authentification(...$authentication); $EPS->getRequest()->customerAddress(...$customerDetails); $EPS->dryRun = true; From 92368a4e103f1009bcf2b3cca364ef8833c03430 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 15:11:57 +0200 Subject: [PATCH 22/51] [cleanup] (PHPLIB-143) EPS: Remove unnecessary returns in test. --- tests/integration/PaymentMethods/EPSPaymentMethodTest.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php index 17127ce..39caa77 100755 --- a/tests/integration/PaymentMethods/EPSPaymentMethodTest.php +++ b/tests/integration/PaymentMethods/EPSPaymentMethodTest.php @@ -88,7 +88,6 @@ public function _before() /** * Test case for a single EPS authorize * - * @return string payment reference id for the EPS authorize transaction * @group connectionTest * * @throws Exception @@ -112,14 +111,11 @@ public function testAuthorize() $this->assertEmpty($response->getProcessing()->getRedirect()->getUrl()); $this->logDataToDebug($result); - - return (string)$response->getPaymentReferenceId(); } /** * Test case for a single EPS authorize * - * @return string payment reference id for the EPS authorize transaction * @group connectionTest * * @throws Exception @@ -149,7 +145,5 @@ public function testAuthorizeFrontendDisabled() //$this->assertNotEmpty($response->getProcessing()->getRedirect()->getParameter()); $this->logDataToDebug($result); - - return (string)$response->getPaymentReferenceId(); } } From 77abcd2151b94565efce9709568efa75ecff0cd3 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Tue, 14 May 2019 15:19:07 +0200 Subject: [PATCH 23/51] [cleanup] (PHPLIB-143) EPS: Update changelog. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c391f6..f20c2e4 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [X.X.X][X.X.X] + +### Added +- Allow EPS payment type without bank selection in shop. +- Example for EPS without bank selection. + ## [v1.7.1][v1.7.1] ### Added From 44f9aacbbb9bc6cf58ad8d0256f45a3e50503572 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Wed, 15 May 2019 08:35:18 +0200 Subject: [PATCH 24/51] [change] (PHPLIB-146) Giropay: Add basic example. --- example/GiropayAuthorizeWithoutForm.php | 135 ++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 example/GiropayAuthorizeWithoutForm.php diff --git a/example/GiropayAuthorizeWithoutForm.php b/example/GiropayAuthorizeWithoutForm.php new file mode 100644 index 0000000..74bcc3e --- /dev/null +++ b/example/GiropayAuthorizeWithoutForm.php @@ -0,0 +1,135 @@ +getRequest(); + +/** + * Set up your authentication data for heidelpay api + * + * @link https://dev.heidelpay.com/testumgebung/#Authentifizierungsdaten + */ +$giropayRequest->authentification( + '31HA07BC8142C5A171745D00AD63D182', // SecuritySender + '31ha07bc8142c5a171744e5aef11ffd3', // UserLogin + '93167DE7', // UserPassword + '31HA07BC8142C5A171740166AF277E03', // TransactionChannel + true // enable/disable sandbox mode +); + +$giropayRequest->getFrontend()->setResponseUrl('http://technik.heidelpay.de/jonas/responseAdvanced/response.php'); + +// set up customer information required for risk checks +$giropayRequest->customerAddress( + 'Hans', // Given name + 'Zimmer', // Family name + null, // Company Name + '12344', // Customer id of your application + 'Salzachstraße 13', // Billing address street + '', + '1200', // Billing address post code + 'Wien', // Billing address city + 'AT', // Billing address country code + 'support@heidelpay.com' // Customer mail address + ); + +// set up basket or transaction information +$giropayRequest->basketData( + '2843294932', // Reference Id of your application + 23.12, // Amount of this request + 'EUR', // Currency code of this request + '39542395235ßfsokkspreipsr' // A secret passphrase from your application + ); + +// set bank country +$giropayRequest->getAccount()->setCountry('DE'); + +// disable frontend mode -> this shows that there is no additional input necessary by the customer prior to the redirect to the bank selection page. +$giropayRequest->getFrontend()->setEnabled('FALSE'); + +// perform the authorize transaction to retrieve the redirect url and parameters +$giropay->authorize(); + +// get the redirect url and necessary parameters from the response. +$redirectGroup = $giropay->getResponse()->getProcessing()->getRedirect(); +$redirectUrl = $redirectGroup->getUrl(); +$redirectParams = $redirectGroup->getParameter(); + +echo 'RedirectUrl: ' . $redirectUrl; +ksort($redirectParams); +foreach($redirectParams as $key=>$value) { + echo '
RedirectParam ' . $key . ': ' . $value; +} + +/** + * Attention: + * Unfortunately Sandbox-mode and Live-mode have to be handled differently. + * In case of .. + * 1. .. a sandbox transaction no redirect parameters exist and you have to perform a GET-Redirect to the redirect url. + * 2. .. a live mode transaction there will be redirect parameters and you have to submit them via POST-request to the redirect url. + * + * The following example shows one possible solution to this task. + */ +?> + + + + Giropay authorize example + + + + +
+ $param) { + echo ''; + } + ?> + +
+ + + + From e74bfd7d8001e33f3d8184065abc293caca2b097 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Wed, 15 May 2019 08:35:36 +0200 Subject: [PATCH 25/51] [cleanup] Fix comment. --- example/EpsAuthorizeWithoutForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/EpsAuthorizeWithoutForm.php b/example/EpsAuthorizeWithoutForm.php index 479fef7..d7ec106 100644 --- a/example/EpsAuthorizeWithoutForm.php +++ b/example/EpsAuthorizeWithoutForm.php @@ -40,7 +40,7 @@ '31HA07BC8142C5A171745D00AD63D182', // SecuritySender '31ha07bc8142c5a171744e5aef11ffd3', // UserLogin '93167DE7', // UserPassword - '31HA07BC816492169CE30CFBBF83B1D5', // TransactionChannel credit card without 3d secure + '31HA07BC816492169CE30CFBBF83B1D5', // TransactionChannel true // enable/disable sandbox mode ); From 039c021a08760e4277c8f12b91709be59ec8a483 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Wed, 15 May 2019 08:39:00 +0200 Subject: [PATCH 26/51] [change] (PHPLIB-146) Update changelog. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f20c2e4..35a145b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [X.X.X][X.X.X] ### Added -- Allow EPS payment type without bank selection in shop. -- Example for EPS without bank selection. +- Parameter group to allow Online Transfer payments (e.g. EPS, Giropay and iDeal) without bank selection in shop. +- Example for EPS and Giropay without bank selection. ## [v1.7.1][v1.7.1] From 8cd63aa832ff977db2271477a489feaa46f6f460 Mon Sep 17 00:00:00 2001 From: Simon Gabriel Date: Wed, 15 May 2019 08:55:28 +0200 Subject: [PATCH 27/51] [cleanup] Fix errors in changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a145b..5ff9061 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -171,3 +171,5 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [v1.6.0]: https://github.com/heidelpay/php-payment-api/compare/v1.5.0...v1.6.0 [v1.6.1]: https://github.com/heidelpay/php-payment-api/compare/v1.6.0...v1.6.1 [v1.6.2]: https://github.com/heidelpay/php-payment-api/compare/v1.6.1...v1.6.2 +[v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0 +[v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1 From 0f2d06d261553363a929705f22d0d7f35177952b Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Fri, 24 Jan 2020 09:37:37 +0100 Subject: [PATCH 28/51] [change] (PHPLIB-283) Fix san iv test. --- .../PaymentMethods/SantanderInvoicePaymentMethodTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php b/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php index 246adb7..61a38c5 100755 --- a/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php +++ b/tests/integration/PaymentMethods/SantanderInvoicePaymentMethodTest.php @@ -75,6 +75,12 @@ public function _before() ->setTransactionChannel('31HA07BC81856CAD6D8E07858ACD6CFB') ->getAuthenticationArray(); $customerDetails = $this->customerData->getCustomerDataArray(); + $customerDetails[0] = 'Grün'; + $customerDetails[1] = 'Ampel'; + $customerDetails[3] = '12345'; + $customerDetails[4] = 'Lichtweg 2'; + $customerDetails[7] = 'Laterne'; + $customerDetails[9] = 'g.ampel@test.de'; $paymentMethod = new SantanderInvoicePaymentMethod(); $paymentMethod->getRequest()->authentification(...$authentication); From 1a7924a3088b2b40be41f9d1620257048cb8f9c6 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 29 Jan 2020 08:36:42 +0100 Subject: [PATCH 29/51] [change] (PHPLIB-283) Update changelog and version. --- CHANGELOG.md | 6 +++++- lib/Constants/ApiConfig.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ff9061..a9ad054 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [X.X.X][X.X.X] +## [v1.7.2][v1.7.2] ### Added - Parameter group to allow Online Transfer payments (e.g. EPS, Giropay and iDeal) without bank selection in shop. - Example for EPS and Giropay without bank selection. +### Changed +- Several minor updates. + ## [v1.7.1][v1.7.1] ### Added @@ -173,3 +176,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [v1.6.2]: https://github.com/heidelpay/php-payment-api/compare/v1.6.1...v1.6.2 [v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0 [v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1 +[v1.7.2]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v1.7.2 diff --git a/lib/Constants/ApiConfig.php b/lib/Constants/ApiConfig.php index f885c2a..aa29cc0 100755 --- a/lib/Constants/ApiConfig.php +++ b/lib/Constants/ApiConfig.php @@ -18,7 +18,7 @@ */ class ApiConfig { - const SDK_VERSION = 'v1.7.1'; + const SDK_VERSION = 'v1.7.2'; const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post'; const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post'; From acf2abdfdac3dd32e43fe8c8fd8173e921beb2f1 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 14:57:42 +0200 Subject: [PATCH 30/51] [change] (PHPLIB-283) Update travis config - set linux dist to default - remove php 7.0 - add php 7.3 and 7.4 --- .travis.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91a512a..54c7eac 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,7 @@ language: php -dist: trusty matrix: fast_finish: true include: - - php: 7.0 - env: deps=no - - php: 7.0 - env: deps=high - php: 7.1 env: deps=no - php: 7.1 @@ -15,6 +10,14 @@ matrix: env: deps=no - php: 7.2 env: deps=high + - php: 7.3 + env: deps=no + - php: 7.3 + env: deps=high + - php: 7.4 + env: deps=no + - php: 7.4 + env: deps=high cache: directories: - $HOME/.composer/cache @@ -23,7 +26,7 @@ cache: before_install: - ./tests/script/travis_before_install.sh install: - - if [ "$(phpenv version-name)" == "5.6" ]; then travis_wait ./tests/script/travis_install.sh; else ./tests/script/travis_install.sh; fi + - ./tests/script/travis_install.sh script: - ./tests/script/travis_script.sh after_success: From b178fde5d0e656a7d0989df80f92055354cb4c68 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 15:09:53 +0200 Subject: [PATCH 31/51] [change] (PHPLIB-283) Reenable integration tests. --- tests/script/travis_script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/travis_script.sh b/tests/script/travis_script.sh index eb8da79..961cab2 100755 --- a/tests/script/travis_script.sh +++ b/tests/script/travis_script.sh @@ -13,8 +13,8 @@ mv ~/.phpenv/versions/$(phpenv version-name)/xdebug.ini.bak ~/.phpenv/versions/$ ./vendor/bin/codecept build ./vendor/bin/codecept run unit --coverage --coverage-xml -## perform this task only for php 7 with deps=no -if [[ ($(phpenv version-name) == "7.0") && ("$deps" == "no") ]]; then +## perform this task only for php 7.1 with deps=no +if [[ ($(phpenv version-name) == "7.1") && ("$deps" == "no") ]]; then echo "Perform integration tests as well"; ./vendor/bin/codecept run integration fi From 3fbec0af5b8cd3feb3d0284d14b44aa186cfd6e4 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 15:59:56 +0200 Subject: [PATCH 32/51] [change] (PHPLIB-283) Update composer call due to timeouts during install/update command. - add diagnose - raise verbosity --- tests/script/travis_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/script/travis_install.sh b/tests/script/travis_install.sh index be5ea77..9ab9994 100755 --- a/tests/script/travis_install.sh +++ b/tests/script/travis_install.sh @@ -4,8 +4,10 @@ set -e trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR PHPVER=$(phpenv version-name) -INSTALL_COMMAND="composer install --no-interaction --prefer-dist" -UPDATE_COMMAND="composer update --no-interaction --prefer-source" +INSTALL_COMMAND="composer install --no-interaction --prefer-dist --verbose" +UPDATE_COMMAND="composer update --no-interaction --prefer-source --verbose" + +composer diagnose if [ "$deps" == "no" ]; then ${INSTALL_COMMAND} From 604b28bc61375f52ccfaeeaaceb79c92bf87f0e4 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 16:02:24 +0200 Subject: [PATCH 33/51] [change] (PHPLIB-283) Update composer call due to timeouts during install/update command. - add diagnose - raise verbosity --- tests/script/travis_install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/script/travis_install.sh b/tests/script/travis_install.sh index 9ab9994..dedf7ea 100755 --- a/tests/script/travis_install.sh +++ b/tests/script/travis_install.sh @@ -4,10 +4,8 @@ set -e trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR PHPVER=$(phpenv version-name) -INSTALL_COMMAND="composer install --no-interaction --prefer-dist --verbose" -UPDATE_COMMAND="composer update --no-interaction --prefer-source --verbose" - -composer diagnose +INSTALL_COMMAND="composer diagnose; composer install --no-interaction --prefer-dist --verbose" +UPDATE_COMMAND="composer diagnose; composer update --no-interaction --prefer-source --verbose" if [ "$deps" == "no" ]; then ${INSTALL_COMMAND} From 63a363b1e281327f757c39c17ed41008aa15e894 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 16:04:50 +0200 Subject: [PATCH 34/51] [change] (PHPLIB-283) move diagnose call --- tests/script/travis_before_install.sh | 1 + tests/script/travis_install.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/script/travis_before_install.sh b/tests/script/travis_before_install.sh index 8e8b9b1..16385f6 100755 --- a/tests/script/travis_before_install.sh +++ b/tests/script/travis_before_install.sh @@ -13,3 +13,4 @@ mkdir -p "$HOME/.php-cs-fixer" mkdir -p build/logs composer self-update +composer diagnose \ No newline at end of file diff --git a/tests/script/travis_install.sh b/tests/script/travis_install.sh index dedf7ea..d69eec3 100755 --- a/tests/script/travis_install.sh +++ b/tests/script/travis_install.sh @@ -4,8 +4,8 @@ set -e trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR PHPVER=$(phpenv version-name) -INSTALL_COMMAND="composer diagnose; composer install --no-interaction --prefer-dist --verbose" -UPDATE_COMMAND="composer diagnose; composer update --no-interaction --prefer-source --verbose" +INSTALL_COMMAND="composer install --no-interaction --prefer-dist --verbose" +UPDATE_COMMAND="composer update --no-interaction --prefer-source --verbose" if [ "$deps" == "no" ]; then ${INSTALL_COMMAND} From c1aaabbfa5685a6eb53c208147ec7658e54d20b0 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 16:11:38 +0200 Subject: [PATCH 35/51] [change] (PHPLIB-283) move diagnose call --- tests/script/travis_before_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/travis_before_install.sh b/tests/script/travis_before_install.sh index 16385f6..3b653f8 100755 --- a/tests/script/travis_before_install.sh +++ b/tests/script/travis_before_install.sh @@ -13,4 +13,4 @@ mkdir -p "$HOME/.php-cs-fixer" mkdir -p build/logs composer self-update -composer diagnose \ No newline at end of file +composer diagnose --verbose \ No newline at end of file From 61beac4ea0910ee4700badfcc547051f6bf7c779 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 16:41:10 +0200 Subject: [PATCH 36/51] [change] (PHPLIB-283) remove diagnose call --- tests/script/travis_before_install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/script/travis_before_install.sh b/tests/script/travis_before_install.sh index 3b653f8..f38db0e 100755 --- a/tests/script/travis_before_install.sh +++ b/tests/script/travis_before_install.sh @@ -12,5 +12,4 @@ phpenv rehash mkdir -p "$HOME/.php-cs-fixer" mkdir -p build/logs -composer self-update -composer diagnose --verbose \ No newline at end of file +composer self-update \ No newline at end of file From 732f7dff92e82f23d92f70ec5ec6882f9e34266a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Wed, 24 Jun 2020 16:53:38 +0200 Subject: [PATCH 37/51] [change] (PHPLIB-283) remove diagnose call --- tests/script/travis_install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/script/travis_install.sh b/tests/script/travis_install.sh index d69eec3..a7bfe73 100755 --- a/tests/script/travis_install.sh +++ b/tests/script/travis_install.sh @@ -8,9 +8,11 @@ INSTALL_COMMAND="composer install --no-interaction --prefer-dist --verbose" UPDATE_COMMAND="composer update --no-interaction --prefer-source --verbose" if [ "$deps" == "no" ]; then - ${INSTALL_COMMAND} + echo ${INSTALL_COMMAND} + ${INSTALL_COMMAND} fi if [ "$deps" == "high" ]; then - ${UPDATE_COMMAND} + echo ${UPDATE_COMMAND} + ${UPDATE_COMMAND} fi From 699e56d021dad75452db5dba35dd4f3bcb318f46 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 10:21:02 +0200 Subject: [PATCH 38/51] [change] (PHPLIB-283) remove documentor due to composer timeouts --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b43019c..01f3648 100755 --- a/composer.json +++ b/composer.json @@ -11,11 +11,11 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "heidelpay/phpdocumentor": "2.9.1", "codeception/codeception": "~2.3.9", "codeception/aspect-mock": "~3.0.0", "codacy/coverage": "^1.4", - "heidelpay/php-basket-api": "^1.0" + "heidelpay/php-basket-api": "^1.0", + "monolog/monolog": "~1.6" }, "suggest": { "heidelpay/php-message-code-mapper": "You can use this package to provide user-friendly messages instead of error codes.", From 5402df5482758a3ec96ca4c8f6906633547b229d Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 10:49:32 +0200 Subject: [PATCH 39/51] [change] (PHPLIB-283) Update version and CHANGELOG.md --- CHANGELOG.md | 6 ++++++ lib/Constants/ApiConfig.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ad054..79857be 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [v1.7.3][v1.7.3] + +### Fix +- Remove package which led to errors in CI. + ## [v1.7.2][v1.7.2] ### Added @@ -177,3 +182,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0 [v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1 [v1.7.2]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v1.7.2 +[v1.7.3]: https://github.com/heidelpay/php-payment-api/compare/v1.7.2...v1.7.3 diff --git a/lib/Constants/ApiConfig.php b/lib/Constants/ApiConfig.php index aa29cc0..b1b8a6c 100755 --- a/lib/Constants/ApiConfig.php +++ b/lib/Constants/ApiConfig.php @@ -18,7 +18,7 @@ */ class ApiConfig { - const SDK_VERSION = 'v1.7.2'; + const SDK_VERSION = 'v1.7.3'; const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post'; const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post'; From 8682837503932386a8904ac4522d7cefb4691e78 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 10:50:12 +0200 Subject: [PATCH 40/51] [change] (PHPLIB-329) Update supported PHP versions. --- README.md | 9 ++++----- composer.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5df91db..b335876 100755 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ [![Build Status](https://travis-ci.org/heidelpay/php-payment-api.svg?branch=master)](https://travis-ci.org/heidelpay/php-payment-api) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/b1678b370db5462781415cd8800d56f3)](https://www.codacy.com/app/heidelpay/php-payment-api?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/php-payment-api&utm_campaign=Badge_Coverage) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b1678b370db5462781415cd8800d56f3)](https://www.codacy.com/app/heidelpay/php-payment-api?utm_source=github.com&utm_medium=referral&utm_content=heidelpay/php-payment-api&utm_campaign=Badge_Grade) -[![PHP 5.6](https://img.shields.io/badge/php-5.6-blue.svg)](http://www.php.net) -[![PHP 7.0](https://img.shields.io/badge/php-7.0-blue.svg)](http://www.php.net) [![PHP 7.1](https://img.shields.io/badge/php-7.1-blue.svg)](http://www.php.net) -[![PHP 7.1](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net) +[![PHP 7.2](https://img.shields.io/badge/php-7.2-blue.svg)](http://www.php.net) +[![PHP 7.3](https://img.shields.io/badge/php-7.3-blue.svg)](http://www.php.net) +[![PHP 7.4](https://img.shields.io/badge/php-7.4-blue.svg)](http://www.php.net) ![Logo](http://dev.heidelpay.com/devHeidelpay_400_180.jpg) # Welcome to the heidelpay payment api for php @@ -36,8 +36,7 @@ This is the php payment api for heidelpay. The library will help you to easily i * Payolution invoice ### SYSTEM REQUIREMENTS - -php-payment-api requires PHP 5.6 or higher; we recommend using the latest stable PHP version whenever possible. +php-payment-api requires PHP 7.1 or higher; we recommend using the latest stable PHP version whenever possible. ## SECURITY ADVICE If you want to store the output of this library e.g. into a database, please make sure that your diff --git a/composer.json b/composer.json index 01f3648..9770c5f 100755 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "New client library for heidelpay payments replacing heidelpay/php-api.", "license": "proprietary", "require": { - "php": ">=5.6.0", + "php": ">=7.1", "lib-curl": "*", "lib-openssl": "*", "ext-SimpleXML": "*", From aa256fc868a9f4f4f31b9b1f90783d6b6db223ff Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 11:14:40 +0200 Subject: [PATCH 41/51] [change] (PHPLIB-329) Update dependencies. --- composer.json | 10 ++++---- .../Constraints/ArraysMatchConstraint.php | 23 ++++++++++++------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 9770c5f..2c9117b 100755 --- a/composer.json +++ b/composer.json @@ -10,12 +10,12 @@ "ext-json": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.0", - "codeception/codeception": "~2.3.9", - "codeception/aspect-mock": "~3.0.0", - "codacy/coverage": "^1.4", + "friendsofphp/php-cs-fixer": "^2.16", + "codeception/codeception": "^4.1", + "codeception/aspect-mock": "^3.1", "heidelpay/php-basket-api": "^1.0", - "monolog/monolog": "~1.6" + "monolog/monolog": "^1.25", + "codeception/module-asserts": "^1.2" }, "suggest": { "heidelpay/php-message-code-mapper": "You can use this package to provide user-friendly messages instead of error codes.", diff --git a/tests/Helper/Constraints/ArraysMatchConstraint.php b/tests/Helper/Constraints/ArraysMatchConstraint.php index 7c6eed6..13e2035 100755 --- a/tests/Helper/Constraints/ArraysMatchConstraint.php +++ b/tests/Helper/Constraints/ArraysMatchConstraint.php @@ -2,9 +2,16 @@ namespace Heidelpay\Tests\PhpPaymentApi\Helper\Constraints; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Exception; use PHPUnit\Util\InvalidArgumentHelper; -class ArraysMatchConstraint extends \PHPUnit_Framework_Constraint +use function array_key_exists as array_key_existsAlias; +use function count; +use function is_array; +use function is_bool; + +class ArraysMatchConstraint extends Constraint { /** * @var array @@ -29,21 +36,21 @@ class ArraysMatchConstraint extends \PHPUnit_Framework_Constraint * @param bool $count * @param bool $strict * - * @throws \PHPUnit\Framework\Exception + * @throws Exception */ public function __construct($value, $count = false, $strict = false) { parent::__construct(); - if (!\is_array($value)) { + if (!is_array($value)) { throw InvalidArgumentHelper::factory(1, 'array'); } - if (!\is_bool($count)) { + if (!is_bool($count)) { throw InvalidArgumentHelper::factory(2, 'boolean'); } - if (!\is_bool($strict)) { + if (!is_bool($strict)) { throw InvalidArgumentHelper::factory(3, 'boolean'); } @@ -62,14 +69,14 @@ public function __construct($value, $count = false, $strict = false) * * @return bool */ - public function matches($other) + public function matches($other) :bool { if (!is_array($other)) { return false; } foreach ($this->value as $key => $value) { - if (!array_key_exists($key, $other)) { + if (!array_key_existsAlias($key, $other)) { $this->failureMessage = "Expected key: '" . $key . "' " . 'is missing'; return false; } @@ -111,7 +118,7 @@ public function matches($other) * * @return string */ - public function toString() + public function toString() :string { $ret_val = 'matches expected Array ('; From c291a6a9f8bde29e6ace2d08ce214e1196a37187 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 11:16:45 +0200 Subject: [PATCH 42/51] [change] (PHPLIB-329) Update CHANGELOG.md. --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79857be..14185a4 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [v1.7.3][v1.7.3] -### Fix +### Fixed - Remove package which led to errors in CI. +### Changed +- Updated dependencies. +- Refactored ArraysMatchConstraint to new dependency version. +- Several minor changes. + ## [v1.7.2][v1.7.2] ### Added From 7e6c248208281fb94f2d43629f90da224b935589 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 11:18:02 +0200 Subject: [PATCH 43/51] [change] (PHPLIB-329) Remove debug provisions. --- tests/script/travis_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/travis_install.sh b/tests/script/travis_install.sh index a7bfe73..111f7cb 100755 --- a/tests/script/travis_install.sh +++ b/tests/script/travis_install.sh @@ -4,8 +4,8 @@ set -e trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR PHPVER=$(phpenv version-name) -INSTALL_COMMAND="composer install --no-interaction --prefer-dist --verbose" -UPDATE_COMMAND="composer update --no-interaction --prefer-source --verbose" +INSTALL_COMMAND="composer install --no-interaction --prefer-dist" +UPDATE_COMMAND="composer update --no-interaction --prefer-source" if [ "$deps" == "no" ]; then echo ${INSTALL_COMMAND} From d592a866ca1dd0ab42f90b1e85ae0c2478890f5a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 11:58:43 +0200 Subject: [PATCH 44/51] [change] (PHPLIB-329) Test java presence --- tests/script/travis_before_install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/script/travis_before_install.sh b/tests/script/travis_before_install.sh index f38db0e..0fe3824 100755 --- a/tests/script/travis_before_install.sh +++ b/tests/script/travis_before_install.sh @@ -12,4 +12,7 @@ phpenv rehash mkdir -p "$HOME/.php-cs-fixer" mkdir -p build/logs -composer self-update \ No newline at end of file +composer self-update + +echo "Java Version" +java -version \ No newline at end of file From 9059bd30979f0ccd229c13bc60365915001d4a4e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 12:01:58 +0200 Subject: [PATCH 45/51] [change] (PHPLIB-329) Replace codacy report tool. --- .travis.yml | 2 +- tests/script/travis_before_install.sh | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54c7eac..df15643 100755 --- a/.travis.yml +++ b/.travis.yml @@ -30,4 +30,4 @@ install: script: - ./tests/script/travis_script.sh after_success: - - php vendor/bin/codacycoverage clover tests/_output/coverage.xml + - bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l PHP -r tests/_output/coverage.xml diff --git a/tests/script/travis_before_install.sh b/tests/script/travis_before_install.sh index 0fe3824..8e8b9b1 100755 --- a/tests/script/travis_before_install.sh +++ b/tests/script/travis_before_install.sh @@ -13,6 +13,3 @@ mkdir -p "$HOME/.php-cs-fixer" mkdir -p build/logs composer self-update - -echo "Java Version" -java -version \ No newline at end of file From 884e0145511308059f175c4c122bc23e4c11016a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 13:20:24 +0200 Subject: [PATCH 46/51] [change] (PHPLIB-329) set phpunit version. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2c9117b..5aeff05 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "codeception/aspect-mock": "^3.1", "heidelpay/php-basket-api": "^1.0", "monolog/monolog": "^1.25", - "codeception/module-asserts": "^1.2" + "codeception/module-asserts": "^1.2", + "phpunit/phpunit": "^7.5" }, "suggest": { "heidelpay/php-message-code-mapper": "You can use this package to provide user-friendly messages instead of error codes.", From 3a6d2408eeaaac9bd7afd517e17270a207229310 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 13:30:14 +0200 Subject: [PATCH 47/51] [change] (PHPLIB-329) fix --- tests/Helper/Constraints/ArraysMatchConstraint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Helper/Constraints/ArraysMatchConstraint.php b/tests/Helper/Constraints/ArraysMatchConstraint.php index 13e2035..c9d2327 100755 --- a/tests/Helper/Constraints/ArraysMatchConstraint.php +++ b/tests/Helper/Constraints/ArraysMatchConstraint.php @@ -6,7 +6,7 @@ use PHPUnit\Framework\Exception; use PHPUnit\Util\InvalidArgumentHelper; -use function array_key_exists as array_key_existsAlias; +use function array_key_exists; use function count; use function is_array; use function is_bool; @@ -76,7 +76,7 @@ public function matches($other) :bool } foreach ($this->value as $key => $value) { - if (!array_key_existsAlias($key, $other)) { + if (!array_key_exists($key, $other)) { $this->failureMessage = "Expected key: '" . $key . "' " . 'is missing'; return false; } From 573807c9088eb96521283025de7da90c85078b1a Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 13:31:15 +0200 Subject: [PATCH 48/51] [change] (PHPLIB-329) Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14185a4..34e07a7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Changed - Updated dependencies. - Refactored ArraysMatchConstraint to new dependency version. +- Replaced codacy/coverage with codacy/codacy-coverage-reporter. +- Set integration tests to use PHP 7.1. - Several minor changes. ## [v1.7.2][v1.7.2] From d17b3076095c1cc7aef42d990ed1d73020fec6fd Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Thu, 25 Jun 2020 16:36:53 +0200 Subject: [PATCH 49/51] [change] (PHPLIB-329) Update CHANGELOG.md and version. --- CHANGELOG.md | 18 ++++++------------ lib/Constants/ApiConfig.php | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34e07a7..b0690e9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,25 +3,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [v1.7.3][v1.7.3] +## [v1.7.2][v1.7.2] -### Fixed +### Removed - Remove package which led to errors in CI. -### Changed -- Updated dependencies. -- Refactored ArraysMatchConstraint to new dependency version. -- Replaced codacy/coverage with codacy/codacy-coverage-reporter. -- Set integration tests to use PHP 7.1. -- Several minor changes. - -## [v1.7.2][v1.7.2] - ### Added - Parameter group to allow Online Transfer payments (e.g. EPS, Giropay and iDeal) without bank selection in shop. - Example for EPS and Giropay without bank selection. ### Changed +- Updated dependencies. +- Refactored ArraysMatchConstraint to new dependency version. +- Replaced codacy/coverage with codacy/codacy-coverage-reporter. +- Set integration tests to use PHP 7.1. - Several minor updates. ## [v1.7.1][v1.7.1] @@ -189,4 +184,3 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0 [v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1 [v1.7.2]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v1.7.2 -[v1.7.3]: https://github.com/heidelpay/php-payment-api/compare/v1.7.2...v1.7.3 diff --git a/lib/Constants/ApiConfig.php b/lib/Constants/ApiConfig.php index b1b8a6c..aa29cc0 100755 --- a/lib/Constants/ApiConfig.php +++ b/lib/Constants/ApiConfig.php @@ -18,7 +18,7 @@ */ class ApiConfig { - const SDK_VERSION = 'v1.7.3'; + const SDK_VERSION = 'v1.7.2'; const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post'; const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post'; From 3c7eea090b5a96aae549ac38a8e2c1daba1c8b0e Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 30 Jun 2020 14:28:54 +0200 Subject: [PATCH 50/51] [change] (PHPLIB-329) Update CHANGELOG.md and version. --- CHANGELOG.md | 4 ++-- lib/Constants/ApiConfig.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0690e9..ec85541 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [v1.7.2][v1.7.2] +## [v2.0.0][v2.0.0] ### Removed - Remove package which led to errors in CI. @@ -183,4 +183,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [v1.6.2]: https://github.com/heidelpay/php-payment-api/compare/v1.6.1...v1.6.2 [v1.7.0]: https://github.com/heidelpay/php-payment-api/compare/v1.6.2...v1.7.0 [v1.7.1]: https://github.com/heidelpay/php-payment-api/compare/v1.7.0...v1.7.1 -[v1.7.2]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v1.7.2 +[v2.0.0]: https://github.com/heidelpay/php-payment-api/compare/v1.7.1...v2.0.0 diff --git a/lib/Constants/ApiConfig.php b/lib/Constants/ApiConfig.php index aa29cc0..7378095 100755 --- a/lib/Constants/ApiConfig.php +++ b/lib/Constants/ApiConfig.php @@ -18,7 +18,7 @@ */ class ApiConfig { - const SDK_VERSION = 'v1.7.2'; + const SDK_VERSION = 'v2.0.0'; const LIVE_URL = 'https://heidelpay.hpcgw.net/ngw/post'; const TEST_URL = 'https://test-heidelpay.hpcgw.net/ngw/post'; From 29b0fa1dc99844916cb38f54a9be9d44ffa46508 Mon Sep 17 00:00:00 2001 From: sixer1182 Date: Tue, 30 Jun 2020 14:54:11 +0200 Subject: [PATCH 51/51] [change] (PHPLIB-329) Update CHANGELOG.md and version. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec85541..489f318 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Removed - Remove package which led to errors in CI. +- Remove support for PHP 5.6 and 7.0. ### Added - Parameter group to allow Online Transfer payments (e.g. EPS, Giropay and iDeal) without bank selection in shop.