Skip to content

Commit

Permalink
Merge pull request #272 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 10.1.0
  • Loading branch information
peterojo authored Apr 30, 2021
2 parents 86aad64 + 0ff1cc9 commit 9191751
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"friendsofphp/php-cs-fixer": "*",
"phpunit/phpunit": "9.5.4",
"php-coveralls/php-coveralls": "2.4.3",
"squizlabs/php_codesniffer": "3.5.8"
"squizlabs/php_codesniffer": "3.6.0"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 11 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion src/Adyen/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Client
{
const LIB_VERSION = "10.0.0";
const LIB_VERSION = "10.1.0";
const LIB_NAME = "adyen-php-api-library";
const USER_AGENT_SUFFIX = "adyen-php-api-library/";
const ENDPOINT_TEST = "https://pal-test.adyen.com";
Expand All @@ -28,6 +28,7 @@ class Client
const API_ACCOUNT_VERSION = "v5";
const API_FUND_VERSION = "v5";
const API_DISPUTE_SERVICE_VERSION = "v30";
const API_HOP_VERSION = "v5";
const ENDPOINT_TERMINAL_CLOUD_TEST = "https://terminal-api-test.adyen.com";
const ENDPOINT_TERMINAL_CLOUD_LIVE = "https://terminal-api-live.adyen.com";
const ENDPOINT_CHECKOUT_TEST = "https://checkout-test.adyen.com/checkout";
Expand All @@ -43,6 +44,8 @@ class Client
const ENDPOINT_DISPUTE_SERVICE_LIVE = "https://ca-live.adyen.com/ca/services/DisputeService";
const ENDPOINT_CUSTOMER_AREA_TEST = "https://ca-test.adyen.com";
const ENDPOINT_CUSTOMER_AREA_LIVE = "https://ca-live.adyen.com";
const ENDPOINT_HOP_TEST = "https://cal-test.adyen.com/cal/services/Hop";
const ENDPOINT_HOP_LIVE = "https://cal-live.adyen.com/cal/services/Hop";

/**
* @var Config|ConfigInterface
Expand Down Expand Up @@ -150,6 +153,7 @@ public function setEnvironment($environment, $liveEndpointUrlPrefix = null)
$this->config->set('endpointFund', self::ENDPOINT_FUND_TEST);
$this->config->set('endpointDisputeService', self::ENDPOINT_DISPUTE_SERVICE_TEST);
$this->config->set('endpointCustomerArea', self::ENDPOINT_CUSTOMER_AREA_TEST);
$this->config->set('endpointHop', self::ENDPOINT_HOP_TEST);
} elseif ($environment == \Adyen\Environment::LIVE) {
$this->config->set('environment', \Adyen\Environment::LIVE);
$this->config->set('endpointDirectorylookup', self::ENDPOINT_LIVE_DIRECTORY_LOOKUP);
Expand All @@ -159,6 +163,7 @@ public function setEnvironment($environment, $liveEndpointUrlPrefix = null)
$this->config->set('endpointFund', self::ENDPOINT_FUND_LIVE);
$this->config->set('endpointDisputeService', self::ENDPOINT_DISPUTE_SERVICE_LIVE);
$this->config->set('endpointCustomerArea', self::ENDPOINT_CUSTOMER_AREA_LIVE);
$this->config->set('endpointHop', self::ENDPOINT_HOP_LIVE);

if ($liveEndpointUrlPrefix) {
$this->config->set(
Expand Down Expand Up @@ -382,6 +387,16 @@ public function getApiAccountVersion()
return self::API_ACCOUNT_VERSION;
}

/**
* Get the version of the HOP (Hosted Onboarding Page) API endpoint
*
* @return string
*/
public function getApiHopVersion()
{
return self::API_HOP_VERSION;
}

/**
* Get the version of the Fund API endpoint
*
Expand Down
49 changes: 49 additions & 0 deletions src/Adyen/Service/Hop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace Adyen\Service;

class Hop extends \Adyen\Service
{
/**
* @var ResourceModel\Hop\GetOnboardingUrl
*/
protected $getOnboardingUrl;

/**
* @var ResourceModel\Hop\GetPciQuestionnaireUrl
*/
protected $getPciQuestionnaireUrl;

/**
* Hop constructor.
* @param \Adyen\Client $client
* @throws \Adyen\AdyenException
*/
public function __construct(\Adyen\Client $client)
{
parent::__construct($client);

$this->getOnboardingUrl = new \Adyen\Service\ResourceModel\Hop\GetOnboardingUrl($this);
$this->getPciQuestionnaireUrl = new \Adyen\Service\ResourceModel\Hop\GetPciQuestionnaireUrl($this);
}

/**
* @param $params
* @return mixed
* @throws \Adyen\AdyenException
*/
public function getOnboardingUrl($params)
{
return $this->getOnboardingUrl->request($params);
}

/**
* @param $params
* @return mixed
* @throws \Adyen\AdyenException
*/
public function getPciQuestionnaireUrl($params)
{
return $this->getPciQuestionnaireUrl->request($params);
}
}
22 changes: 22 additions & 0 deletions src/Adyen/Service/ResourceModel/Hop/GetOnboardingUrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Adyen\Service\ResourceModel\Hop;

class GetOnboardingUrl extends \Adyen\Service\AbstractResource
{
/**
* @var string
*/
protected $endpoint;

/**
* GetOnboardingUrl constructor.
* @param $service
*/
public function __construct($service)
{
$this->endpoint = $service->getClient()->getConfig()->get('endpointHop') .
'/' . $service->getClient()->getApiHopVersion() . '/getOnboardingUrl';
parent::__construct($service, $this->endpoint);
}
}
22 changes: 22 additions & 0 deletions src/Adyen/Service/ResourceModel/Hop/GetPciQuestionnaireUrl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Adyen\Service\ResourceModel\Hop;

class GetPciQuestionnaireUrl extends \Adyen\Service\AbstractResource
{
/**
* @var string
*/
protected $endpoint;

/**
* GetPciQuestionnaireUrl constructor.
* @param $service
*/
public function __construct($service)
{
$this->endpoint = $service->getClient()->getConfig()->get('endpointHop') .
'/' . $service->getClient()->getApiHopVersion() . '/getPciQuestionnaireUrl';
parent::__construct($service, $this->endpoint);
}
}
14 changes: 14 additions & 0 deletions tests/Resources/Hop/invalid-return-url.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"invalidFields": [
{
"errorCode": 91,
"errorDescription": "The return url specified is invalid",
"fieldType": {
"field": "returnUrl",
"fieldName": "returnUrl"
}
}
],
"pspReference": "8816163576602761",
"resultCode": "Failed"
}
6 changes: 6 additions & 0 deletions tests/Resources/Hop/url-failure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"status": 500,
"errorCode": "702",
"message": "Required field 'accountHolderCode' is null",
"errorType": "validation"
}
6 changes: 6 additions & 0 deletions tests/Resources/Hop/url-success.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"invalidFields": [],
"pspReference": "8616163562170106",
"resultCode": "Success",
"redirectUrl": "https://hop-test.adyen.com/hop/view/?token=tokenValue"
}
Loading

0 comments on commit 9191751

Please sign in to comment.