Skip to content

Commit e1e45bd

Browse files
authored
Merge pull request #95 from payplug/qa
Release 1.17.0
2 parents f7ca892 + c1b1f31 commit e1e45bd

30 files changed

+380
-286
lines changed

Block/Formjs.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public function getJsUrl()
4444
*/
4545
public function isEmbedded()
4646
{
47-
return $this->helper->isEmbedded() || $this->helper->getConfigValue(
48-
'one_click',
49-
ScopeInterface::SCOPE_STORE,
50-
null,
51-
'payment/payplug_payments_standard/'
52-
);
47+
return $this->helper->isEmbedded() || $this->helper->isOneClick();
5348
}
5449
}

Block/Oney/Simulation.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ class Simulation extends Template
1313
*/
1414
private $amount;
1515

16+
/**
17+
* @var int
18+
*/
19+
private $qty;
20+
1621
/**
1722
* @var Oney
1823
*/
@@ -66,14 +71,34 @@ public function getAmount()
6671
return $this->amount;
6772
}
6873

74+
/**
75+
* @param int|null $qty
76+
*
77+
* @return $this
78+
*/
79+
public function setQty($qty): self
80+
{
81+
$this->qty = $qty;
82+
83+
return $this;
84+
}
85+
86+
/**
87+
* @return int|null
88+
*/
89+
public function getQty()
90+
{
91+
return $this->qty;
92+
}
93+
6994
/**
7095
* @param bool $validationOnly
7196
*
7297
* @return Result
7398
*/
7499
public function getOneySimulation(bool $validationOnly = false): Result
75100
{
76-
return $this->oneyHelper->getOneySimulation($this->getAmount(), null, $validationOnly);
101+
return $this->oneyHelper->getOneySimulation($this->getAmount(), null, $this->getQty(), $validationOnly);
77102
}
78103

79104
/**

Block/OneyInfo.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Payplug\Payments\Block;
44

55
use Magento\Framework\Exception\NoSuchEntityException;
6+
use Magento\Sales\Model\Order;
67
use Payplug\Exception\PayplugException;
78
use Payplug\Payments\Helper\Data;
89
use Payplug\Payments\Helper\Oney;
@@ -35,8 +36,8 @@ protected function buildPaymentDetails($payment, $order)
3536
$paymentDetails['Status'] = $status;
3637

3738
$oneyOption = str_replace('oney_', '', $payment->payment_method['type']);
38-
if (isset(Oney::ALLOWED_OPERATIONS[$oneyOption])) {
39-
$paymentDetails['Oney option'] = __('Payment in %1', Oney::ALLOWED_OPERATIONS[$oneyOption]);
39+
if (isset(Oney::ALLOWED_OPERATIONS_BY_PAYMENT[$order->getPayment()->getMethod()][$oneyOption])) {
40+
$paymentDetails['Oney option'] = __('Payment in %1', Oney::ALLOWED_OPERATIONS_BY_PAYMENT[$order->getPayment()->getMethod()][$oneyOption]);
4041
}
4142

4243
return $paymentDetails;

Controller/Adminhtml/Order/InstallmentPlanAbort.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public function execute()
9393
} catch (PayplugException $e) {
9494
$this->payplugLogger->error($e->__toString());
9595
$this->messageManager->addErrorMessage(
96-
sprintf(__('An error occured while aborting the installment plan: %s.'), $e->getMessage())
96+
sprintf(__('An error occurred while aborting the installment plan: %s.'), $e->getMessage())
9797
);
9898
} catch (\Exception $e) {
9999
$this->payplugLogger->error($e->getMessage());
100100
$this->messageManager->addErrorMessage(
101-
sprintf(__('An error occured while aborting the installment plan: %s.'), $e->getMessage())
101+
sprintf(__('An error occurred while aborting the installment plan: %s.'), $e->getMessage())
102102
);
103103
}
104104

Controller/Adminhtml/Order/SendNewPaymentLink.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function execute()
108108
} catch (PayplugException $e) {
109109
$this->payplugLogger->error($e->__toString());
110110
$this->messageManager->addErrorMessage(
111-
sprintf(__('An error occured while sending new payment link: %s.'), $e->getMessage())
111+
sprintf(__('An error occurred while sending new payment link: %s.'), $e->getMessage())
112112
);
113113
} catch (OrderAlreadyProcessingException $e) {
114114
// Order is already being processed (by payment return controller or IPN)
@@ -117,7 +117,7 @@ public function execute()
117117
} catch (\Exception $e) {
118118
$this->payplugLogger->error($e->getMessage());
119119
$this->messageManager->addErrorMessage(
120-
sprintf(__('An error occured while sending new payment link: %s.'), $e->getMessage())
120+
sprintf(__('An error occurred while sending new payment link: %s.'), $e->getMessage())
121121
);
122122
}
123123

Controller/Adminhtml/Order/UpdatePayment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function execute()
8989
} catch (PayplugException $e) {
9090
$this->payplugLogger->error($e->__toString());
9191
$this->messageManager->addErrorMessage(
92-
sprintf(__('An error occured while updating the payment: %s.'), $e->getMessage())
92+
sprintf(__('An error occurred while updating the payment: %s.'), $e->getMessage())
9393
);
9494
} catch (OrderAlreadyProcessingException $e) {
9595
// Order is already being processed (by payment return controller or IPN)
@@ -98,7 +98,7 @@ public function execute()
9898
} catch (\Exception $e) {
9999
$this->payplugLogger->error($e->getMessage());
100100
$this->messageManager->addErrorMessage(
101-
sprintf(__('An error occured while updating the payment: %s.'), $e->getMessage())
101+
sprintf(__('An error occurred while updating the payment: %s.'), $e->getMessage())
102102
);
103103
}
104104

Controller/Oney/Simulation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function execute()
6363
$params = $this->getRequest()->getParams();
6464
$productPrice = null;
6565
$product = $this->getProduct($params);
66+
$qty = null;
6667
if ($product !== null) {
6768
$qty = $params['qty'] ?? 1;
6869
$qty = (int)$qty;
@@ -79,6 +80,7 @@ public function execute()
7980
$block = $this->layout->createBlock(\Payplug\Payments\Block\Oney\Simulation::class)
8081
->setTemplate($template)
8182
->setAmount($productPrice)
83+
->setQty($qty)
8284
;
8385

8486
$result->setData([

Controller/Oney/SimulationCheckout.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function execute()
6262
$simulationResult = $this->oneyHelper->getOneySimulationCheckout(
6363
$params['amount'],
6464
$params['billingCountry'] ?? null,
65-
$shippingCountry
65+
$shippingCountry,
66+
$params['paymentMethod'] ?? null
6667
);
6768

6869
$result->setData([

Controller/Payment/Ipn.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@ private function processDebugCall($response)
141141
$ipnStoreId = $this->getRequest()->getParam('ipn_store_id');
142142
$environmentMode = $this->getConfigValue('environmentmode', $ipnStoreId);
143143
$embeddedMode = $this->getConfigValue('payment_page', $ipnStoreId);
144-
$oneClick = $this->getConfigValue(
145-
'one_click',
146-
$ipnStoreId,
147-
'payment/payplug_payments_standard/'
148-
);
144+
$oneClick = $this->payplugConfig->isOneClick($ipnStoreId);
149145

150146
$data = [
151147
'is_module_active' => 1,

Controller/Payment/Standard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function execute()
5656
$this->logger->error($e->__toString());
5757
if ($shouldRedirect) {
5858
$this->messageManager->addErrorMessage(
59-
__('An error occured while processing your payment. Please try again.')
59+
__('An error occurred while processing your payment. Please try again.')
6060
);
6161
return $this->resultRedirectFactory->create()->setPath(
6262
'payplug_payments/payment/cancel',
@@ -85,7 +85,7 @@ public function execute()
8585

8686
if ($shouldRedirect) {
8787
$this->messageManager->addErrorMessage(
88-
__('An error occured while processing your payment. Please try again.')
88+
__('An error occurred while processing your payment. Please try again.')
8989
);
9090
return $this->resultRedirectFactory->create()->setPath(
9191
'payplug_payments/payment/cancel',

0 commit comments

Comments
 (0)