Plugin Directory

Changeset 2279767


Ignore:
Timestamp:
04/09/2020 12:30:17 AM (6 years ago)
Author:
sujon3g
Message:

added the integration of sms api

Location:
bkash/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bkash/trunk/bkash.php

    r2277891 r2279767  
    168168                $order = new WC_Order( $order_id );
    169169                if( $order->get_payment_method() == $this->id ){
     170
    170171                    $thankyou = $this->instructions;
    171172                    return $thankyou;
    172173                } else {
     174
    173175                    return esc_html__( 'Thank you. Your order has been received.', "stb" );
    174176                }
  • bkash/trunk/index.php

    r2277893 r2279767  
    44Plugin URI:  http://softtech-it.com
    55Description: This plugin helps users to integrate bkash , rocket and nagad payment gateway with woocommerce. bKash, rocket and rocket all of them are money transfer systems of Bangladesh by facilitating money transfer through mobile phones. This plugin is an addon for woocommerce and will provide 3 extra payment gateways through bKash, rocket and nagad in checkout page.
    6 Version:     2.1
     6Version:     2.2
    77Author:      Md Toriqul Mowla Sujan
    88Author URI:  http://facebook.com/sujan4g
     
    1919load_plugin_textdomain( 'stb', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    2020
     21add_action("admin_menu", "softtechit_add_sms_submenu_page");
     22
     23function softtechit_add_sms_submenu_page(){
     24  add_submenu_page( 'woocommerce', 'SMS API Integration Page', 'SMS API Integration',
     25    'manage_options', 'stit-sms-integration', 'stit_sms_integration_callback');
     26}
     27
     28function stit_sms_integration_callback(){
     29
     30  if (!current_user_can('manage_options')) {
     31      wp_die('Unauthorized user');
     32  }
     33
     34  if (isset($_POST['save'])) {
     35
     36    if (isset($_POST['sms-api-url'])) {
     37      $url = $_POST["sms-api-url"];
     38      update_option('sms-api-url', $url);
     39    }
     40
     41    if (isset($_POST['sms-api-username'])) {
     42      $username = $_POST["sms-api-username"];
     43      update_option('sms-api-username', $username);
     44    }
     45
     46    if (isset($_POST['sms-api-password'])) {
     47      $password = $_POST["sms-api-password"];
     48      update_option('sms-api-password', $password);
     49    }
     50
     51    echo '<div id="setting-error-settings_updated" class="notice notice-success settings-error is-dismissible">
     52<p><strong>Settings saved.</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>';
     53
     54  }
     55
     56  $sms_url = get_option('sms-api-url', 'http://66.45.237.70/api.php');
     57  $sms_username = get_option('sms-api-username', 'user');
     58  $sms_password = get_option('sms-api-password', 'pass');
     59  ?>
     60  <div class="wrap woocommerce">
     61    <form method="post" id="mainform" action="" enctype="multipart/form-data">
     62    <?php settings_errors(); ?>
     63    <h1>SMS API Integration</h1>
     64    <table class="form-table">
     65      <tbody>
     66        <tr valign="top">
     67          <th scope="row" class="titledesc">
     68            <label for="sms-api-url">API URL </label>
     69          </th>
     70          <td class="forminp">
     71            <fieldset>
     72              <legend class="screen-reader-text"><span>API URL</span></legend>
     73              <input class="input-text regular-input " type="url" name="sms-api-url" id="sms-api-url" style="" value="<?php echo $sms_url; ?>" placeholder="">
     74              <p class="description">The API link / url you have got from your sms gateway provider. It can be like this ( http://66.45.237.70/api.php )</p>
     75            </fieldset>
     76          </td>
     77        </tr>
     78
     79        <tr valign="top">
     80          <th scope="row" class="titledesc">
     81            <label for="sms-api-username">Username </label>
     82          </th>
     83          <td class="forminp">
     84            <fieldset>
     85              <legend class="screen-reader-text"><span>Username</span></legend>
     86              <input class="input-text regular-input " type="text" name="sms-api-username" id="sms-api-username" style="" value="<?php echo $sms_username; ?>" placeholder="">
     87              <p class="description">The Username of your API</p>
     88            </fieldset>
     89          </td>
     90        </tr>
     91
     92        <tr valign="top">
     93          <th scope="row" class="titledesc">
     94            <label for="sms-api-password">Password </label>
     95          </th>
     96          <td class="forminp">
     97            <fieldset>
     98              <legend class="screen-reader-text"><span>Password</span></legend>
     99              <input class="input-text regular-input " type="password" name="sms-api-password" id="sms-api-password" style="" value="<?php echo $sms_password; ?>" placeholder="">
     100              <p class="description">The Password of your API</p>
     101            </fieldset>
     102          </td>
     103        </tr>
     104
     105
     106      </tbody>
     107    </table>
     108
     109    <p class="submit">
     110      <?php wp_nonce_field( 'sms_nonce_field' ); ?>
     111      <button name="save" class="button-primary woocommerce-save-button" type="submit" value="Save changes">Save changes</button>
     112
     113    </p>
     114  </form>
     115  </div>
     116  <?php
     117}
     118
     119add_filter("woocommerce_thankyou_order_received_text", "softtechit_send_sms_when_order_received");
     120
     121function softtechit_send_sms_when_order_received(){
     122
     123  $order_id = get_query_var('order-received');
     124  $order = new WC_Order( $order_id );
     125
     126  $sms_url = get_option('sms-api-url', 'http://66.45.237.70/api.php');
     127  $sms_username = get_option('sms-api-username', 'user');
     128  $sms_password = get_option('sms-api-password', 'pass');
     129
     130  $url = $sms_url;
     131  $username = $sms_username;
     132  $password = $sms_password;
     133  $phone = "88" . $order->get_billing_phone();
     134  $message = "Hello " . $order->get_billing_first_name() . " " . $order->get_billing_last_name() . "," ."\n\nthank you for your order \n#" . $order_id . ". View the latest status of your order here\n" . site_url() ."/my-account/orders/";
     135  $data = array(
     136    "username" => $username,
     137    "password" => $password,
     138    "number" => $phone,
     139    "message" => $message,
     140  );
     141
     142  $ch = curl_init();
     143  curl_setopt($ch, CURLOPT_URL, $url );
     144  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data) );
     145  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
     146  $smsresult = curl_exec($ch);
     147}
     148
     149
     150
     151
     152
     153
     154
    21155
    22156add_action( 'wp_enqueue_scripts', 'softtech_payment_method_script' );
  • bkash/trunk/readme.txt

    r2277891 r2279767  
    44Requires at least: 4.5.0
    55Tested up to: 5.4
    6 Stable tag: 2.1
     6Stable tag: 2.2
    77Stable tag: trunk
    88License: GPLv2 or later
     
    1313== Description ==
    1414
    15 This is a cool plugin to integrate bKash , Rocket and Nagad payment gateway in any woocommerce based website. It is lightweight and very easy to use.
     15This is a cool plugin to integrate bKash , Rocket and Nagad payment gateway and also SMS api in any woocommerce based website. It is lightweight and very easy to use.
    1616
    1717Please note:
    1818- This is a woocommerce based plugin so woocommerce plugin must be activated.
    1919- You must have a bKash or Rocket or Nagad account to get payments.
     20- you must have bulksmsbd.com account to integrate sms api
    2021
    2122= Using the Plugin =
     
    3031
    3132* Now you will see few default setup but you need to fill up bKash/Rocket/Nagad account number under <strong>bKash Number/Rocket Number/Nagad Number</strong> field, also you might adjust other fileds too.
     33
     34* If you want to send sms to users automatically when they order any product,
     35then at first create an account to bulksmsbd.com and recharge some amount to buy sms credit. you will get an option named API in the bulksmsbd dashboard, go to the API page and you will get the API url in that page. after that please login to your wordpress dashboard and then go to
     36WooCommerce > SMS API Integration, then insert the api url, your bulksmsbd username and password and save
    3237
    3338* That's it. You are ready to go!
     
    6368== Changelog ==
    6469
     70= 2.2 =
     71* Added - sms api integrated
     72
    6573= 2.1 =
    6674* Fix - made the bkash , rocket and nagad charges to round number
Note: See TracChangeset for help on using the changeset viewer.