Skip to content

Commit

Permalink
pushed from bitbucket
Browse files Browse the repository at this point in the history
  • Loading branch information
1jenkins committed May 19, 2021
1 parent 98d4792 commit aeaa20e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Block/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ protected function _prepareLayout()
$this->toolkit_url = $api->rapyd_get_toolkit_url();
}
//set initial state after token created
$order->setState(Order::STATE_HOLDED)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_HOLDED));
$order->setState(Order::STATE_PENDING_PAYMENT)
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_PENDING_PAYMENT));
$order->save();

$this->setAction(json_encode($rapyd_data, JSON_UNESCAPED_SLASHES));
Expand Down
3 changes: 2 additions & 1 deletion Model/Api/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Rapyd\Rapydmagento2\Model\Api;

use Magento\Framework\View\Element\Template\Context;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Payment\Transaction\Builder as TransactionBuilder;
use Magento\Sales\Model\OrderFactory;

Expand Down Expand Up @@ -36,7 +37,7 @@ public function getPost($rapyd_data)
$order_note = $body['magento_order_note'];
$order->setState($orderState)->setStatus($orderState);
$order->save();
if ($orderState=="pending_payment") {//rapyd act
if ($orderState==Order::STATE_HOLDED) {//rapyd act
$this->addTransactionToOrder($order, $body['payment_token'], 0, $order_note);
} elseif ($orderState=="processing" || $orderState=="canceled") {
if (!$this->updateTransaction($order, $body['payment_token'], $order_note)) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "rapyd/rapydmagento2",
"description": "Rapyd Payments Plugin for Magento",
"type": "magento2-module",
"version": "1.0.4",
"version": "1.0.5",
"license": [
"Apache-2.0"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<system>
<section id="payment">
<group id="rapyd" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Rapyd Payments Settings (v1.0.4)</label>
<label>Rapyd Payments Settings (v1.0.5)</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
Expand Down
8 changes: 8 additions & 0 deletions lib/RapydRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public function rapyd_get_test_mode()

public function rapyd_get_api_url()
{
$api_url = getenv('RAPYD_PLUGIN_URL_TEST');
if (!empty($api_url) && $api_url) {
return $api_url;
}
if ('1' == $this->test_mode || 'yes' == $this->test_mode) {
return \Rapyd\Rapydmagento2\lib\RapydConsts::RAPYD_PLUGIN_URL_TEST;
}
Expand All @@ -119,6 +123,10 @@ public function rapyd_get_api_url()

public function rapyd_get_toolkit_url()
{
$toolkit_url = getenv('RAPYD_TOOLKIT_JS_URL_TEST');
if (!empty($toolkit_url) && $toolkit_url) {
return $toolkit_url;
}
if ('1' == $this->test_mode || 'yes' == $this->test_mode) {
return \Rapyd\Rapydmagento2\lib\RapydConsts::RAPYD_TOOLKIT_JS_URL_TEST;
}
Expand Down

0 comments on commit aeaa20e

Please sign in to comment.