Skip to content

Commit

Permalink
added cron url in settings to copy (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramth05 authored Oct 7, 2021
1 parent b962283 commit 48fc7f1
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions Model/WebhookUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,43 @@ protected function _getElementHtml(AbstractElement $element)
{

$baseUrl = $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB);
$copyButton = "<div class='rzp-webhook-to-clipboard'
style='background-color: #337ab7; color: white; border: none;cursor: pointer; padding: 2px 4px; text-decoration: none;display: inline-block;'>Copy Url</div>

$copyButton = "<sapn class='rzp-webhook-to-clipboard'
style='background-color: #337ab7; color: white; border: none;cursor: pointer; padding: 2px 4px; text-decoration: none;display: inline-block;'>Copy Url</span>
<script type='text/javascript'>
//<![CDATA[
require([
'jquery'
], function ($) {
'use strict';
$(function() {
$('.rzp-webhook-to-clipboard').click(function() {
$('.rzp-webhook-to-clipboard').click(function() {
var temp = $('<input>');
$('body').append(temp);
temp.val($('.rzp-webhook-url').text()).select();
document.execCommand('copy');
temp.remove();
$('.rzp-webhook-to-clipboard').text('Copied to clipboard');
});
$('.rzp-webhook-to-clipboard-cron').click(function() {
var temp = $('<input>');
$('body').append(temp);
temp.val($('.rzp-webhook-cron-url').text()).select();
document.execCommand('copy');
temp.remove();
$('.rzp-webhook-to-clipboard-cron').text('Copied to clipboard');
});
});
});
//]]>
</script>
";

$element->setComment("*Please use below url for webhook* <span style='width:300px;font-weight: bold;' class='rzp-webhook-url' >" . $baseUrl . "razorpay/payment/webhook</span>" . $copyButton );
$copyCronButton = "<span class='rzp-webhook-to-clipboard-cron'
style='background-color: #337ab7; color: white; border: none;cursor: pointer; padding: 2px 4px; text-decoration: none;display: inline-block;'>Copy Url</span>";

$element->setComment("*Please use below url for webhook* <span style='width:300px;font-weight: bold;' class='rzp-webhook-url' >" . $baseUrl . "razorpay/payment/webhook</span><br/>" . $copyButton . "<br/>*Please use below url to <b>set cron-job for 5 mins intervals</b> to process missing order* <span style='width:300px;font-weight: bold;' class='rzp-webhook-cron-url' >" . $baseUrl . "razorpay/payment/WebhookOrderCron</span><br/>" . $copyCronButton );

return $element->getElementHtml();

Expand Down

0 comments on commit 48fc7f1

Please sign in to comment.