Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Framework\App\State as AppState;
use Magento\Framework\DB\Transaction as DbTransaction;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Filesystem\Driver\File;
Expand Down Expand Up @@ -77,6 +78,11 @@ class Data extends AbstractHelper
*/
private $dateTimeFactory;

/**
* @var AppState
*/
private $appState;

/**
* @var ScopeConfigInterface
*/
Expand Down Expand Up @@ -150,7 +156,8 @@ public function __construct(
OrderNotifier $orderNotifier,
AssetRepository $assetRepository,
CategoryRepository $categoryRepository,
\Xendit\M2Invoice\Helper\PhoneNumberFormat $phoneNumberFormatHelper
\Xendit\M2Invoice\Helper\PhoneNumberFormat $phoneNumberFormatHelper,
AppState $appState
) {
$this->storeManager = $storeManager;
$this->xendit = $xendit;
Expand All @@ -168,6 +175,7 @@ public function __construct(
$this->assetRepository = $assetRepository;
$this->categoryRepository = $categoryRepository;
$this->phoneNumberFormatHelper = $phoneNumberFormatHelper;
$this->appState = $appState;

parent::__construct($context);
}
Expand All @@ -185,6 +193,11 @@ protected function getStoreManager()
*/
public function getXenditApiUrl()
{
// This is here for testing in xendit
$xenditUrlInput = $this->scopeConfig->getValue('payment/xendit/xendit_url', ScopeInterface::SCOPE_STORE);
if (!empty($xenditUrlInput) && $this->appState->getMode() === AppState::MODE_DEVELOPER) {
return $xenditUrlInput;
}
return $this->xendit->getConfigData('xendit_url');
}

Expand Down
8 changes: 8 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@
</comment>
<frontend_model>Xendit\M2Invoice\Block\Adminhtml\System\Config\DeveloperModeField</frontend_model>
</field>
<field id="xendit_url" translate="label" type="text" sortOrder="69"
showInDefault="1" showInWebsite="1" showInStore="1">
<label>Xendit URL</label>
<comment>
<![CDATA[Override Xendit URL.]]>
</comment>
<frontend_model>Xendit\M2Invoice\Block\Adminhtml\System\Config\DeveloperModeField</frontend_model>
</field>

<group id="other_configurations" translate="label" sortOrder="92" showInDefault="1"
showInWebsite="1" showInStore="1">
Expand Down