Skip to content

Commit

Permalink
Merge branch 'v5-dev-mdl-329' into 'v5-develop'
Browse files Browse the repository at this point in the history
fix payment config for widget



See merge request !4
  • Loading branch information
David Hoang committed Feb 7, 2018
2 parents 2640e34 + f9d5c7f commit 2ae8850
Showing 1 changed file with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Shopware_Controllers_Frontend_Paymentwall extends Shopware_Controllers_Fro
const PAYMENT_CANCELED = 35;
const PAYMENT_NO_CREDIT_APPROVED = 30;
const PAYMENT_REVIEW_NECESSARY = 21;
const PAYMENT_BRICK = 'brick';

public $_unsetParams = array();

Expand Down Expand Up @@ -148,31 +149,19 @@ public function getRequestParams()
*/
public function pingbackAction()
{
Paymentwall_Config::getInstance()->set(array(
'api_type' => Paymentwall_Config::API_GOODS,
'public_key' => trim($this->config->get("publicKey")), // available in your Paymentwall merchant area
'private_key' => trim($this->config->get("secretKey"))// available in your Paymentwall merchant area
));

$getData = $this->getRequestParams();
$orderId = $getData['goodsid'];
$paymentId = $this->getPaymentIdByOrderId($orderId);
$paymentName = $this->getPaymentNameByPaymentId($paymentId);

Paymentwall_Config::getInstance()->set(array(
'api_type' => Paymentwall_Config::API_GOODS,
'public_key' => trim($this->config->get("publicKey")), // available in your Paymentwall merchant area
'private_key' => ($this->config->get("testMode") && $paymentName == self::PAYMENT_BRICK) ? trim($this->config->get("privateKey")) : trim($this->config->get("secretKey"))// available in your Paymentwall merchant area
));

$pingback = new Paymentwall_Pingback($getData, $_SERVER['REMOTE_ADDR']);
$order = Shopware()->Modules()->Order();
if(!$pingback->validate()) {
if ($paymentName == 'brick') {
Paymentwall_Config::getInstance()->set(array(
'api_type' => Paymentwall_Config::API_GOODS,
'public_key' => trim($this->config->get("publicKey")), // available in your Paymentwall merchant area
'private_key' => $this->config->get("testMode") ? trim($this->config->get("privateKey")) : trim($this->config->get("secretKey"))// available in your Paymentwall merchant area
));
}

$pingback = new Paymentwall_Pingback($getData, $_SERVER['REMOTE_ADDR']);
}

$sendMail = true;

if ($pingback->validate()) {
Expand All @@ -191,7 +180,6 @@ public function pingbackAction()
} else {
die($pingback->getErrorSummary());
}

}

private function getOrderIdByOrderNumber($orderNumber)
Expand Down Expand Up @@ -236,4 +224,3 @@ public function redirectAction()
die;
}
}

0 comments on commit 2ae8850

Please sign in to comment.