-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+webhook Integration and Shopping Credit
- Loading branch information
1 parent
0ea7cb8
commit 6750021
Showing
34 changed files
with
1,002 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Iyzico\Iyzipay\Api; | ||
|
||
/** | ||
* Interface WebhookInterface | ||
* | ||
* @package Iyzico\Iyzipay\Api | ||
*/ | ||
interface WebhookInterface | ||
{ | ||
/** | ||
* Add one number. | ||
* | ||
* @param string $webhookUrlKey | ||
* @return string | ||
*/ | ||
public function getResponse($webhookUrlKey); | ||
|
||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
namespace Iyzico\Iyzipay\Block\Adminhtml\Config; | ||
|
||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
|
||
class Disable extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
protected function _getElementHtml(AbstractElement $element) | ||
{ | ||
$element->setDisabled('disabled'); | ||
return $element->getElementHtml(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Iyzico\Iyzipay\Block\Adminhtml\Config; | ||
|
||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
|
||
/** | ||
* Class webhookurl | ||
* | ||
* @package Iyzico\Iyzipay\Block\Adminhtml\System\Config\Fieldset | ||
*/ | ||
class getWebhookUrl extends Field | ||
{ | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
* @throws NoSuchEntityException | ||
*/ | ||
protected function _getElementHtml(AbstractElement $element): string | ||
{ | ||
|
||
$webhookUrlKey = $this->_scopeConfig->getValue('payment/iyzipay/webhook_url_key'); | ||
if(isset($webhookUrlKey)) | ||
{ | ||
|
||
return $this->_storeManager->getStore()->getBaseUrl().'rest/V1/iyzico/webhook/'.$webhookUrlKey.'<br>'.$this->iyzicoWebhookSubmitbutton(); | ||
} | ||
else { | ||
return 'clear cookies and later "save config button" push'; | ||
} | ||
|
||
} | ||
|
||
|
||
public function iyzicoWebhookSubmitbutton() | ||
{ | ||
|
||
$webhookButtonSet = $this->_scopeConfig->getValue('payment/iyzipay/webhook_url_key_active'); | ||
if($webhookButtonSet == 2) | ||
{ | ||
$htmlButton = '<form action="#" method="post"> | ||
<button class="btn btn-light" type="submit" name="button">Active</button> <a href="mailto:[email protected]">[email protected]</a> | ||
</form> '; | ||
|
||
$post_data = $this->getRequest()->getPost(); | ||
if(isset($post_data)) | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); | ||
$connection = $resource->getConnection(); | ||
$tableName = $resource->getTableName('core_config_data'); //gives table name with prefix | ||
$sql = "Update " . $tableName." Set value = '0' Where path = 'payment/iyzipay/webhook_url_key_active'"; | ||
$result = $connection->query($sql); | ||
} | ||
return $htmlButton; | ||
|
||
} | ||
|
||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.