Skip to content

Commit

Permalink
Merge pull request #176 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
peterojo authored May 27, 2021
2 parents 80357b8 + 916d487 commit ca650da
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @cyattilakiss @acampos1916 @msilvagarcia @rikterbeek @peterojo @morerice
* @cyattilakiss @acampos1916 @rikterbeek @peterojo @morerice
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen",
"version": "2.0.0",
"version": "2.1.0",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down
311 changes: 169 additions & 142 deletions composer.lock

Large diffs are not rendered by default.

Large diffs are not rendered by default.

57 changes: 54 additions & 3 deletions src/Resources/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,49 @@
<input-field type="text">
<name>merchantAccount</name>
<label>Merchant account</label>
<helpText>
Enter your merchant account identifier.
This can be found in your Adyen Customer Area, at the top of the screen you will see [YourCompanyAccount] &gt; [YourMerchantAccount].
Please note that the merchant account is different from the company account; a company account can have one or more merchant accounts.
See https://docs.adyen.com/plugins/shopware-6#set-up-shopware
</helpText>
</input-field>
<input-field type="password">
<name>apiKeyTest</name>
<label>API Key for test</label>
<helpText>
Enter your test API Key. This can be found in your test Customer Area &gt; Account &gt; API Credentials.
See https://docs.adyen.com/plugins/shopware-6#set-up-api-key
For a live environment, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>apiKeyLive</name>
<label>API Key for live</label>
<helpText>
Enter your live API Key. This can be found in your live Customer Area &gt; Account &gt; API Credentials.
See https://docs.adyen.com/plugins/shopware-6#set-up-api-key.
For a test environment, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>clientKeyTest</name>
<label>Client Key for test</label>
<helpText>
We use your client key to authenticate requests from your payment environment.
This can be found in your test Customer Area &gt; Account &gt; API Credentials.
See https://docs.adyen.com/plugins/shopware-6#generate-a-client-key for more information.
For a live environment, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>clientKeyLive</name>
<label>Client Key for live</label>
<helpText>
We use your client key to authenticate requests from your payment environment.
This can be found in your live Customer Area &gt; Account &gt; API Credentials.
See https://docs.adyen.com/plugins/shopware-6#generate-a-client-key for more information.
For a test environment, this field can be empty.
</helpText>
</input-field>
<input-field type="bool">
Expand All @@ -39,25 +59,56 @@
<input-field type="text">
<name>liveEndpointUrlPrefix</name>
<label>Live endpoint URL prefix</label>
<helpText>
The URL prefix [random]-[company name] from your Adyen live Customer Area &gt; Account &gt; API URLs.
For a test environment, this field can be empty.
</helpText>
</input-field>
<component name="adyen-config-check-button">
<name>configTest</name>
</component>
</card>
<card>
<title>Notification Credentials</title>
<input-field type="text">
<name>notificationUsername</name>
<label>Username for standard notifications</label>
<helpText>
This is the username for basic authentication of your live endpoints.
Fill in from your live Adyen Customer Area &gt; Account &gt; Webhooks &gt; Edit or Add.
See https://docs.adyen.com/plugins/shopware-6#set-up-notifications.
For testing the plugin without notifications, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>notificationPassword</name>
<label>Password for standard notifications</label>
<helpText>
This is the password for basic authentication of your live endpoints.
Fill in from your live Adyen Customer Area &gt; Account &gt; Webhooks &gt; Edit or Add.
See https://docs.adyen.com/plugins/shopware-6#set-up-notifications.
For testing the plugin without notifications, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>hmacTest</name>
<label>HMAC Key for test</label>
<helpText>
This is used to authenticate your endpoints.
If you want to test the webhook notifications then get your test HMAC Key from your test Adyen Customer Area &gt; Account &gt; Webhooks &gt; Edit or Add.
See https://docs.adyen.com/plugins/shopware-6#set-up-notifications.
For testing the plugin without notifications, this field can be empty.
</helpText>
</input-field>
<input-field type="password">
<name>hmacLive</name>
<label>HMAC Key for live</label>
<helpText>
This is used to authenticate your endpoints.
Fill in your live HMAC Key from your live Adyen Customer Area &gt; Account &gt; Webhooks &gt; Edit or Add.
See https://docs.adyen.com/plugins/shopware-6#set-up-notifications.
For testing the plugin without notifications, this field can be empty.
</helpText>
</input-field>
<component name="adyen-config-check-button">
<name>configTest</name>
</component>
</card>
</config>

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

10 changes: 5 additions & 5 deletions src/Struct/AdyenPaymentMethodDataStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AdyenPaymentMethodDataStruct extends Struct
/**
* @var array|null
*/
protected $paymentMethodsResponse = null;
protected $paymentMethodConfig = null;

public function getType(): ?string
{
Expand All @@ -48,13 +48,13 @@ public function setType(?string $type): void
$this->type = $type;
}

public function getPaymentMethodsResponse(): ?array
public function getPaymentMethodConfig(): ?array
{
return $this->paymentMethodsResponse;
return $this->paymentMethodConfig;
}

public function setPaymentMethodsResponse(?array $paymentMethodsResponse): void
public function setPaymentMethodConfig(?array $paymentMethodConfig): void
{
$this->paymentMethodsResponse = $paymentMethodsResponse;
$this->paymentMethodConfig = $paymentMethodConfig;
}
}
18 changes: 8 additions & 10 deletions src/Subscriber/Response/PaymentMethodRouteResponseSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,26 @@ private function extendPaymentMethodsData(SalesChannelContext $context, PaymentM
$extension->setType($type);

if (!empty($type)) {
$extension->setPaymentMethodsResponse($this->getPaymentMethodsResponseForType($context, $type));
$extension->setPaymentMethodConfig($this->getPaymentMethodConfigByType($context, $type));
}

$method->addExtension('adyenData', $extension);
}
}

private function getPaymentMethodsResponseForType(SalesChannelContext $context, string $type)
private function getPaymentMethodConfigByType(SalesChannelContext $context, string $type)
{
$paymentMethodsResponse = $this->getPaymentMethodsResponse($context);
if (empty($paymentMethodsResponse['paymentMethods'])) {
return $paymentMethodsResponse;
return null;
}

$paymentMethodsResponse['paymentMethods'] = array_filter(
$paymentMethodsResponse['paymentMethods'],
function ($value) use ($type) {
return ($value['type'] ?? null) == $type;
foreach ($paymentMethodsResponse['paymentMethods'] as $paymentMethodConfig) {
if (($paymentMethodConfig['type'] ?? null) == $type) {
return $paymentMethodConfig;
}
);
}

return $paymentMethodsResponse;
return null;
}

private function getPaymentMethodType(PaymentMethodEntity $method): ?string
Expand Down

0 comments on commit ca650da

Please sign in to comment.