-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #645 from mollie/release/2.26.0
Release/2.26.0
- Loading branch information
Showing
44 changed files
with
1,251 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Model/Client/Orders/Processors/PaymentLinkPaymentMethod.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Mollie\Payment\Model\Client\Orders\Processors; | ||
|
||
use Magento\Sales\Api\Data\OrderInterface; | ||
use Mollie\Api\Resources\Order; | ||
use Mollie\Payment\Model\Client\OrderProcessorInterface; | ||
use Mollie\Payment\Model\Client\ProcessTransactionResponse; | ||
|
||
class PaymentLinkPaymentMethod implements OrderProcessorInterface | ||
{ | ||
public function process( | ||
OrderInterface $magentoOrder, | ||
Order $mollieOrder, | ||
string $type, | ||
ProcessTransactionResponse $response | ||
): ?ProcessTransactionResponse { | ||
if ($magentoOrder->getPayment()->getMethod() !== 'mollie_methods_paymentlink') { | ||
return $response; | ||
} | ||
|
||
$magentoOrder->getPayment()->setAdditionalInformation('payment_link_method_used', $mollieOrder->method); | ||
|
||
return $response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Mollie\Payment\Service\Mollie; | ||
|
||
use Magento\Payment\Model\MethodInterface; | ||
|
||
class FormatExceptionMessages | ||
{ | ||
private $allowedErrorMessages = [ | ||
'The billing country is not supported for this payment method.', | ||
'A billing organization name is required for this payment method.', | ||
]; | ||
|
||
private $convertErrorMessages = [ | ||
'The webhook URL is invalid because it is unreachable from Mollie\'s point of view' => 'The webhook URL is invalid because it is unreachable from Mollie\'s point of view. View this article for more information: https://github.com/mollie/magento2/wiki/Webhook-Communication-between-your-Magento-webshop-and-Mollie', | ||
]; | ||
|
||
public function execute(\Exception $exception, MethodInterface $methodInstance = null): string | ||
{ | ||
foreach ($this->allowedErrorMessages as $message) { | ||
if (stripos($exception->getMessage(), $message) !== false) { | ||
return $message; | ||
} | ||
} | ||
|
||
foreach ($this->convertErrorMessages as $search => $replacement) { | ||
if (stripos($exception->getMessage(), $search) !== false) { | ||
return __($replacement)->render(); | ||
} | ||
} | ||
|
||
if ($methodInstance && stripos($exception->getMessage(), 'cURL error 28') !== false) { | ||
return __( | ||
'A Timeout while connecting to %1 occurred, this could be the result of an outage. ' . | ||
'Please try again or select another payment method.', | ||
$methodInstance->getTitle() | ||
)->render(); | ||
} | ||
|
||
return $exception->getMessage(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,88 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
const defaultProductId = process.env.DEFAULT_PRODUCT_ID || 2; | ||
|
||
module.exports = defineConfig({ | ||
projectId: "44bnds", | ||
chromeWebSecurity: false, | ||
retries: { | ||
runMode: 2, | ||
}, | ||
env: { | ||
defaultProductId: defaultProductId, | ||
}, | ||
e2e: { | ||
experimentalWebKitSupport: true, | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
require('./cypress/plugins/index.js')(on, config); | ||
|
||
return new Promise((resolve, reject) => { | ||
var https = require('follow-redirects').https; | ||
var fs = require('fs'); | ||
|
||
const baseUrl = config.baseUrl; | ||
const urlObj = new URL(baseUrl); | ||
const hostname = urlObj.hostname; | ||
|
||
const query = ` | ||
query { | ||
molliePaymentMethods(input:{amount:100, currency:"EUR"}) { | ||
methods { | ||
code | ||
image | ||
name | ||
} | ||
} | ||
} | ||
`; | ||
|
||
var options = { | ||
'method': 'GET', | ||
'hostname': hostname, | ||
'path': '/graphql?query=' + encodeURIComponent(query), | ||
'headers': { | ||
'Content-Type': 'application/json', | ||
// 'Cookie': 'XDEBUG_SESSION=PHPSTORM' | ||
}, | ||
'maxRedirects': 20 | ||
}; | ||
|
||
var req = https.request(options, function (res) { | ||
var chunks = []; | ||
|
||
res.on("data", function (chunk) { | ||
chunks.push(chunk); | ||
}); | ||
|
||
res.on("end", function (chunk) { | ||
const body = Buffer.concat(chunks); | ||
|
||
console.info('Received body', body.toString()); | ||
|
||
const methods = JSON.parse(body.toString()).data.molliePaymentMethods.methods.map(data => { | ||
return data.code | ||
}) | ||
|
||
config.env.mollie_available_methods = methods; | ||
|
||
console.log('Available Mollie payment methods: ', methods); | ||
|
||
resolve(config); | ||
}); | ||
|
||
res.on("error", function (error) { | ||
console.error('Error while fetching Mollie Payment methods', error); | ||
reject(error); | ||
}); | ||
}); | ||
|
||
var postData = JSON.stringify({ | ||
query: '', | ||
variables: {} | ||
}); | ||
|
||
req.end(); | ||
}); | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.