Skip to content

Commit

Permalink
Merge pull request #367 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 13.0.0
  • Loading branch information
candemiralp authored Jun 8, 2022
2 parents 18cee8f + cc4f014 commit f3ba999
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @AlexandrosMor @acampos1916 @peterojo @rikterbeek @morerice @michaelpaul @candemiralp
* @AlexandrosMor @acampos1916 @peterojo @rikterbeek @morerice @michaelpaul @candemiralp @RokPopov
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
INTEGRATION_PASSWORD: ${{ secrets.INTEGRATION_PASSWORD }}
INTEGRATION_X_API_KEY: ${{ secrets.INTEGRATION_X_API_KEY }}
INTEGRATION_MERCHANT_ACCOUNT: ${{ secrets.INTEGRATION_MERCHANT_ACCOUNT }}
INTEGRATION_DONATION_ACCOUNT: ${{ secrets.INTEGRATION_DONATION_ACCOUNT }}
INTEGRATION_SKIN_CODE: ${{ secrets.INTEGRATION_SKIN_CODE }}
INTEGRATION_HMAC_SIGNATURE: ${{ secrets.INTEGRATION_HMAC_SIGNATURE }}
INTEGRATION_STORE_PAYOUT_USERNAME: ${{ secrets.INTEGRATION_STORE_PAYOUT_USERNAME }}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

This is the officially supported PHP library for using Adyen's APIs.

[![version](https://img.shields.io/badge/version-13.0.0-blue.svg)](https://docs.adyen.com/development-resources/libraries)

## Integration
The library supports all APIs under the following services:

* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68**
* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview): Our latest integration for accepting online payments. Current supported version: **v69**
* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v51/overview): Our classic integration for online payments. Current supported version: **v51**
* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49**
* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v51/overview): Endpoints for sending funds to your customers. Current supported version:
Expand Down
4 changes: 2 additions & 2 deletions 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 = "12.2.0";
const LIB_VERSION = "13.0.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 @@ -22,7 +22,7 @@ class Client
const API_BIN_LOOKUP_VERSION = "v50";
const API_PAYOUT_VERSION = "v51";
const API_RECURRING_VERSION = "v49";
const API_CHECKOUT_VERSION = "v68";
const API_CHECKOUT_VERSION = "v69";
const API_CHECKOUT_UTILITY_VERSION = "v1";
const API_NOTIFICATION_VERSION = "v6";
const API_ACCOUNT_VERSION = "v6";
Expand Down
12 changes: 12 additions & 0 deletions src/Adyen/Service/ResourceModel/Management/MerchantAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ public function get($merchantId)
$url = $this->managementEndpoint . "/merchants/" . $merchantId;
return $this->requestHttp($url, 'get');
}

/**
* @param $merchantId
* @param array $queryParams
* @return mixed
* @throws \Adyen\AdyenException
*/
public function paymentMethodSettings($merchantId, array $queryParams = [])
{
$url = $this->managementEndpoint . "/merchants/" . $merchantId . "/paymentMethodSettings";
return $this->requestHttp($url, 'get', $queryParams);
}
}
37 changes: 33 additions & 4 deletions src/Adyen/Service/ResourceModel/Management/MerchantWebhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,31 @@
namespace Adyen\Service\ResourceModel\Management;

use Adyen\AdyenException;
use Adyen\Service\AbstractResource;

class MerchantWebhooks extends \Adyen\Service\AbstractResource
class MerchantWebhooks extends AbstractResource
{
const MERCHANTS = "/merchants/";
const WEBHOOKS = "/webhooks";

/**
* Include applicationInfo key in the request parameters
*
* @var bool
*/
protected $allowApplicationInfo = false;

/**
* @param $merchantId
* @return mixed
* @throws AdyenException
*/
public function list($merchantId)
{
$url = $this->managementEndpoint . self::MERCHANTS . $merchantId . self::WEBHOOKS;
return $this->requestHttp($url, 'get');
}

/**
* @param $merchantId
* @param $params
Expand All @@ -22,7 +37,7 @@ class MerchantWebhooks extends \Adyen\Service\AbstractResource
*/
public function create($merchantId, $params)
{
$url = $this->managementEndpoint . "/merchants/" . $merchantId . "/webhooks";
$url = $this->managementEndpoint . self::MERCHANTS . $merchantId . self::WEBHOOKS;
return $this->requestHttp($url, 'post', $params);
}

Expand All @@ -35,7 +50,7 @@ public function create($merchantId, $params)
*/
public function update($merchantId, $webhookId, $params)
{
$url = $this->managementEndpoint . "/merchants/" . $merchantId . "/webhooks/" . $webhookId;
$url = $this->managementEndpoint . self::MERCHANTS . $merchantId . self::WEBHOOKS . "/" . $webhookId;
return $this->requestHttp($url, 'patch', $params);
}

Expand All @@ -47,7 +62,21 @@ public function update($merchantId, $webhookId, $params)
*/
public function generateHmac($merchantId, $webhookId)
{
$url = $this->managementEndpoint . "/merchants/" . $merchantId . "/webhooks/" . $webhookId . "/generateHmac";
$url = $this->managementEndpoint . self::MERCHANTS . $merchantId . self::WEBHOOKS . "/"
. $webhookId . "/generateHmac";
return $this->requestHttp($url, 'post');
}

/**
* @param $merchantId
* @param $webhookId
* @param $params
* @return mixed
* @throws AdyenException
*/
public function test($merchantId, $webhookId, $params)
{
$url = $this->managementEndpoint . self::MERCHANTS . $merchantId . self::WEBHOOKS . "/" . $webhookId . "/test";
return $this->requestHttp($url, 'post', $params);
}
}
2 changes: 1 addition & 1 deletion tests/Integration/CheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function testDonationsSuccess()
'reference' => "Your order number",
'donationToken' => $paymentResult['donationToken'],
'donationOriginalPspReference' => $paymentResult['pspReference'],
'donationAccount' => $this->merchantAccount,
'donationAccount' => $this->donationAccount,
'returnUrl' => self::RETURN_URL,
'shopperInteraction' => "Ecommerce"
);
Expand Down
39 changes: 39 additions & 0 deletions tests/Integration/ManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,33 @@ public function testGenerateHmac()
$this->assertNotEmpty($response['hmacKey']);
}

/**
* post /merchants/{id}/webhooks/{webhookId}/test
*
* @throws \Adyen\AdyenException
*/
public function testMerchantWebhooksTest()
{
if (empty($this->settings['merchantAccount']) ||
$this->settings['merchantAccount'] == self::YOUR_MERCHANT_ACCOUNT) {
$this->skipTest(self::SKIP_TEST_MESSAGE);
return null;
}
$listWebhooksResponse = $this->management->merchantWebhooks->list($this->settings['merchantAccount']);
$this->assertNotEmpty($listWebhooksResponse);

if (isset($listWebhooksResponse['data'][0]['id'])) {
$params = ['types' => ['AUTHORISATION']];
$testWebhook = $this->management->merchantWebhooks->test(
$this->settings['merchantAccount'],
$listWebhooksResponse['data'][0]['id'],
$params
);
$this->assertNotEmpty($testWebhook);
} else {
$this->fail("Unable to retrieve the webhooks");
}
}

/**
* Get /me/allowedOrigins
Expand Down Expand Up @@ -248,6 +275,18 @@ public function testCreateAllowedOrigins()
}
}

/**
* Get /merchants/{id}/paymentMethodSettings
*/
public function testGetPaymentMethodSettings()
{
$response = $this->management->merchantAccount->paymentMethodSettings($this->settings['merchantAccount']);
$this->assertNotEmpty($response['data']);
$this->assertNotEmpty($response['data'][0]['PaymentMethod']);
$this->assertNotEmpty($response['data'][0]['PaymentMethod']['id']);
$this->assertNotEmpty($response['data'][0]['PaymentMethod']['type']);
}

/**
* @param $e
*/
Expand Down
Loading

0 comments on commit f3ba999

Please sign in to comment.