Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/b-7.1.x' into b-7.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Nov 15, 2024
2 parents 1c23c67 + 05917a4 commit f52aa07
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/Core/Service/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ public function getNotificationUrl(): string
"fnc" => "receiveNotifications",
];

// add xdebug in sandbox for better testing
$sandboxMode = !$this->moduleSettings->isLiveApiMode();
if ($sandboxMode) {
$parameter['XDEBUG_SESSION_START'] = "1";
}

return $this->prepareUrl($parameter);
}

Expand All @@ -153,6 +147,12 @@ public function getNotificationUrl(): string
*/
private function prepareUrl(array $parameter): string
{
// add xdebug in sandbox for better testing
$sandboxMode = !$this->moduleSettings->isLiveApiMode();
if ($sandboxMode) {
$parameter['XDEBUG_SESSION_START'] = "1";
}

return html_entity_decode(
$this->shopConfig->getCurrentShopUrl(false) . 'index.php?' . http_build_query($parameter)
);
Expand Down
5 changes: 5 additions & 0 deletions src/Exception/TeleCashException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ public function serviceNotFound(): self
{
return new self('TELECASH_SERVICE_MISSING');
}

public function noValidTransactionResult(): self
{
return new self('TELECASH_NO_VALID_TRANSACTION_RESULT');
}
}
6 changes: 5 additions & 1 deletion src/Extension/Application/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public function __construct()
public function showTeleCashError(): void
{
$telecashConnect = $this->getTeleCashConnect();
$telecashConnect->addPostData($_POST);
$telecashConnect->setResponseData($_POST);
if (!$telecashConnect->isValidResponse()) {
/** Throw an Error is too hard, but Ok for the moment, Show an Error is better */
throw (new TeleCashException())->noValidTransactionResult();
}

/** TODO follow up the work ...
* We´ve got TeleCashPost-Data
Expand Down
8 changes: 7 additions & 1 deletion src/Extension/Application/Model/PaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ protected function executeTeleCashPayment(float $amount, Order $order): bool
if (!$payment->isTeleCashPayment()) {
return true;
}
$result = false;

$telecashConnect = $this->getTeleCashConnect();
$telecashConnect->setResponseData($_POST);
if (!$telecashConnect->isValidResponse()) {
return false;
}

$result = false;

$telecashConnect->addPostData($_POST);

/** TODO follow up the work ... */
Expand Down
5 changes: 3 additions & 2 deletions translations/de/module_de_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
$aLang = [
'charset' => 'UTF-8',

'TELECASHPAYMENT_EXISTS_FAIL' => 'Die Telecash-Zahlart konnte nicht mit dem Telecash-Ident und dem Capture-Typ gespeichert werden. Sie existiert bereits.',
'TELECASH_SERVICE_MISSING' => 'Ein benötigter Service wurde nicht gefunden.',
'TELECASHPAYMENT_EXISTS_FAIL' => 'Die Telecash-Zahlart konnte nicht mit dem Telecash-Ident und dem Capture-Typ gespeichert werden. Sie existiert bereits.',
'TELECASH_SERVICE_MISSING' => 'Ein benötigter Service wurde nicht gefunden.',
'TELECASH_NO_VALID_TRANSACTION_RESULT' => 'Die Antwort von TeleCash is nicht valide. Die Hash-Prüfung ergab Fehler.',

'TELECASH_ASTERISK' => '*',

Expand Down
5 changes: 3 additions & 2 deletions translations/en/module_en_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
$aLang = [
'charset' => 'UTF-8',

'TELECASHPAYMENT_EXISTS_FAIL' => 'The Telecash payment method could not be saved with the Telecash Ident and the Capture type. It already exists.',
'TELECASH_SERVICE_MISSING' => 'A required service was not found.',
'TELECASHPAYMENT_EXISTS_FAIL' => 'The Telecash payment method could not be saved with the Telecash Ident and the Capture type. It already exists.',
'TELECASH_SERVICE_MISSING' => 'A required service was not found.',
'TELECASH_NO_VALID_TRANSACTION_RESULT' => 'The response from TeleCash is not valid. The hash check resulted in errors.',

'TELECASH_ASTERISK' => '*',

Expand Down

0 comments on commit f52aa07

Please sign in to comment.