Plugin Directory

Changeset 2865279


Ignore:
Timestamp:
02/14/2023 05:52:30 PM (3 years ago)
Author:
aftercommerce
Message:

contract name and description updated

Location:
afterinc-app/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • afterinc-app/trunk/Custom_app.php

    r2862590 r2865279  
    44Plugin URI: https://www.afterinc.com/contact/
    55Description: Plugin allows merchants to sell After Plan’s product protection plans for wide variety of products.
    6 Version: 3.8.4
     6Version: 3.8.5
    77Author: After Inc.
    88Author URI: https://www.afterinc.com
     
    2323
    2424  private $wpdb, $jal_db_version;
     25  const API_BASE_URL = "https://api.quickcover.me/v1/";
    2526
    2627  public function __construct() {
     
    379380        veriant_id int(20) NOT NULL,
    380381        priceCurrency varchar(255) NOT NULL,
    381         planname varchar(255) NOT NULL,
     382        pname varchar(255) NOT NULL,
     383        description varchar(255) NOT NULL,
    382384        priceCategory varchar(255) NOT NULL,
    383385        termsAndConditionsURL varchar(255) NOT NULL,
     
    452454  }
    453455 
     456   function get_currency_symbol(){
     457     return get_woocommerce_currency_symbol();
     458  }
     459 
    454460   function plugin_backup() {
    455461
     
    644650        $product_json = json_encode($dbData);
    645651
    646          $url = 'https://api.quickcover.me/v1/products/outlet/'.$storeId;
     652         $base_url = AfterInc::API_BASE_URL;
     653         $url = $base_url.'products/outlet/'.$storeId;
    647654
    648655         $args = array(
     
    716723        $storeId = $result[0]->store_id;
    717724
    718         $url = 'https://api.quickcover.me/v1/products/outlet/'.$storeId.'?productId='.$product_id;
     725        $base_url = AfterInc::API_BASE_URL;
     726        $url = $base_url.'products/outlet/'.$storeId.'?productId='.$product_id;
    719727
    720728        $args = array(
     
    757765              $product_json = json_encode($dbData);
    758766
    759               $url = 'https://api.quickcover.me/v1/products/outlet/'.$storeId;
     767              $base_url = AfterInc::API_BASE_URL;
     768              $url = $base_url.'products/outlet/'.$storeId;
    760769
    761770              $args = array(
     
    819828              $product_json = json_encode($dbData);
    820829
    821               $url = 'https://api.quickcover.me/v1/products/outlet/'.$storeId;
     830              $base_url = AfterInc::API_BASE_URL;
     831              $url = $base_url.'products/outlet/'.$storeId;
    822832
    823833              $args = array(
     
    887897     $current_user_id = get_current_user_id();
    888898     $currency = get_option('woocommerce_currency');
    889        $url = 'https://api.quickcover.me/v1/price/outlet/'.$storeId.'?productId='.$id.'&currency='.$currency.'&price='.$warrantypric;
     899     
     900       $base_url = AfterInc::API_BASE_URL;
     901       $url = $base_url.'price/outlet/'.$storeId.'?productId='.$id.'&currency='.$currency.'&price='.$warrantypric;
    890902
    891903      $args = array(
     
    909921      $priceCurrency=$warranty_plan->priceCurrency;
    910922      $planName=$warranty_plan->name;
     923      $description=$warranty_plan->description;
    911924      $priceCategory=$warranty_plan->priceCategory;
    912925      $termsAndConditionsURL=$warranty_plan->termsAndConditionsURL;
     
    937950       
    938951         $results = $this->wpdb->query($this->wpdb->prepare("INSERT INTO product_warranty
    939          ( product_id, veriant_id, priceCurrency, planname, priceCategory, termsAndConditionsURL, learnMoreURL, plans )
    940           VALUES ( %d, %d, %s, %s, %s, %s, %s, %s )", $product_id, $veriant_id, $priceCurrency, $planName, $priceCategory, $termsAndConditionsURL, $learnMoreURL, $plans));
     952         ( product_id, veriant_id, priceCurrency, pname, description, priceCategory, termsAndConditionsURL, learnMoreURL, plans )
     953          VALUES ( %d, %d, %s, %s, %s, %s, %s, %s )", $product_id, $veriant_id, $priceCurrency, $planName, $description, $priceCategory, $termsAndConditionsURL, $learnMoreURL, $plans));
    941954
    942955          $warrantyId = $this->wpdb->insert_id;
     
    948961      }else{
    949962
    950       $results = $this->wpdb->query( $this->wpdb->prepare( "UPDATE product_warranty SET veriant_id = %d, priceCurrency = %s, planname = %s, priceCategory = %s, termsAndConditionsURL = %s, learnMoreURL = %s, plans = %s WHERE product_id = %d", $veriant_id, $priceCurrency, $planName, $priceCategory, $termsAndConditionsURL, $learnMoreURL, $plans ,$product_id));
     963      $results = $this->wpdb->query( $this->wpdb->prepare( "UPDATE product_warranty SET veriant_id = %d, priceCurrency = %s, pname = %s, description = %s, priceCategory = %s, termsAndConditionsURL = %s, learnMoreURL = %s, plans = %s WHERE product_id = %d", $veriant_id, $priceCurrency, $planName, $description, $priceCategory, $termsAndConditionsURL, $learnMoreURL, $plans ,$product_id));
    951964
    952965      }
     
    10041017    <div class="parent-warranty-class">
    10051018      <span class="sortOptions"> 
    1006       <p class="planheading"><?php echo esc_attr($result[0]->planname); ?> </p>
     1019      <p class="planheading"><?php echo esc_attr($result[0]->description); ?> </p>
    10071020     
    10081021      <input type="hidden" class="warranty-id" value="<?php echo esc_attr($result[0]->id); ?>">
     
    11101123   
    11111124        $totalPrice = (float) $productActualPrice + (float) $warrantyPrice;
    1112         echo esc_attr($totalPrice);
     1125        echo json_encode(['totalPrice'=>$totalPrice,'currency_symbol'=>$this->get_currency_symbol()]);
    11131126        exit();
    11141127
     
    11281141
    11291142          $totalPrice1 = (float) $productActualPrice + (float) $warrantyPrice;
    1130            $totalPrice= sprintf('%.2f',$totalPrice1);
    1131           echo esc_attr($totalPrice);
     1143          $totalPrice= sprintf('%.2f',$totalPrice1);
     1144           
     1145          echo json_encode(['totalPrice'=>$totalPrice,'currency_symbol'=>$this->get_currency_symbol()]);
    11321146          exit();
    11331147    }
     
    13231337     $current_date = sanitize_text_field($_POST['currentTime']);
    13241338
    1325       $url = 'https://api.quickcover.me/v1/authenticate-store/storeId='.$storeid.'/apiKey='.$apikey;
     1339      $base_url = AfterInc::API_BASE_URL;
     1340      $url = $base_url.'authenticate-store/storeId='.$storeid.'/apiKey='.$apikey;
    13261341
    13271342        $body = array(
     
    14981513        $productJson = json_encode($productLists);
    14991514     
    1500         $url = 'https://api.quickcover.me/v1/products/batch/outlet/'.$quick_store_id.'?upsert=true';
     1515        $base_url = AfterInc::API_BASE_URL;
     1516        $url = $base_url.'products/batch/outlet/'.$quick_store_id.'?upsert=true';
     1517       
    15011518        $body = array(
    15021519            'headers' => array(
     
    17751792            $cancel_contract = json_encode($cancel_contract);
    17761793
    1777             $url = 'https://api.quickcover.me/v1/contracts/outlet/'.$storeId.'/cancel';
     1794            $base_url = AfterInc::API_BASE_URL;
     1795            $url = $base_url.'contracts/outlet/'.$storeId.'/cancel';
    17781796
    17791797             $args = array(
     
    18041822                    }
    18051823
    1806                     $response = array('status' => 200, 'res' => $refundamt);
     1824                    $response = array('status' => 200, 'res' => $refundamt, 'currency_symbol' => $this->get_currency_symbol());
    18071825                    echo json_encode($response);
    18081826                    die();
     
    18371855      $storeId = $result[0]->store_id; 
    18381856
    1839       $url = 'https://api.quickcover.me/v1/products/outlet/'.$storeId.'?productId='.$post_id;
     1857      $base_url = AfterInc::API_BASE_URL;
     1858      $url = $base_url.'products/outlet/'.$storeId.'?productId='.$post_id;
    18401859
    18411860      $args = array(
     
    19311950 */
    19321951
    1933   function add_item_meta($item_data, $cart_item)
     1952function add_item_meta($item_data, $cart_item)
    19341953  {
    19351954
    19361955    if(array_key_exists('warranty', $cart_item))
    19371956    {
    1938      // echo "<pre>"; print_r($cart_item); die;
    1939 
    1940       $planname = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty"));
     1957     $product_id = $cart_item['product_id'];
     1958
     1959      $warrantyData = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty WHERE product_id=".$product_id));
    19411960     
    1942       $pname = $planname[0]->planname;
     1961      $pname = $warrantyData[0]->pname;
    19431962
    19441963      $plan_id = $cart_item['warranty'];
     
    19541973        $item_data[] = array(
    19551974            'key'   => $pname,
    1956             'value' => $term." Months"
     1975            'value' => ""
    19571976        );
    19581977         
    1959       }
    1960     }
     1978       }
     1979     }
    19611980      return $item_data;
    19621981  }
     
    20952114
    20962115         $orderList = json_encode($order_array);
    2097          // print_r($orderList);die;
    20982116        $result = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT * FROM app_configurations WHERE id = %d", 1 ));
    20992117
     
    21022120        $storeId = $result[0]->store_id;
    21032121
    2104          $url = 'https://api.quickcover.me/v1/orders/outlet/'.$storeId;
     2122        $base_url = AfterInc::API_BASE_URL;
     2123        $url = $base_url.'orders/outlet/'.$storeId;
    21052124
    21062125        $args = array(
     
    21352154            }
    21362155         } 
    2137       } else {
     2156      }
     2157     
     2158      else {
    21382159       
    21392160        $dataCron = $this->wpdb->insert('quickcover_cron_status', array(
     
    21762197             $storeId = $result[0]->store_id;
    21772198             
    2178               $url = 'https://api.quickcover.me/v1/contracts/outlet/'.$storeId.'/cancel';
     2199              $base_url = AfterInc::API_BASE_URL;
     2200              $url = $base_url.'contracts/outlet/'.$storeId.'/cancel';
    21792201
    21802202              $args = array(
     
    22232245  }
    22242246   //contract cancel from customer end.
    2225   function woocommerce_order_item_name( $name, $item ){
    2226      
    2227      $get_configuration_property = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM app_configurations"));
    2228     $quickCover_status = $get_configuration_property[0]->configuration_property;
    2229 
    2230     $planname = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty")); 
    2231     $pnamecustomer = $planname[0]->planname;
    2232  
     2247  function woocommerce_order_item_name( $name, $item ){ 
     2248 
    22332249  $customUrl = esc_url_raw($_SERVER['REQUEST_URI']);
    22342250  $customUrl = strtolower($customUrl);
     
    22432259  $product_id = $item['product_id'];
    22442260    $item_warrantys = $item->get_meta_data();
     2261   
     2262    $get_configuration_property = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM app_configurations"));
     2263    $quickCover_status = $get_configuration_property[0]->configuration_property;
     2264
     2265    $warrantyData = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty WHERE product_id=".$product_id));
     2266    $pnamecustomer = $warrantyData[0]->pname;
     2267   
    22452268   foreach ($item_warrantys as $key => $item_warranty) {
    22462269    if(isset($item_warranty->key) && ($item_warranty->key == '_warranty')){
     
    22542277
    22552278if(isset($result[0]->contract_status) && $result[0]->contract_status == '200' && $result[0]->refund_amount !=''){
    2256   $refundtxt = "<b>Cancelled By: <b>".$result[0]->contract_canceled_by."<br> Contract has been Cancelled Successfully ,We have initiated the Refund of";
     2279  $refundtxt = "<b>Cancelled By: <b>".$result[0]->contract_canceled_by."<br> Contract has been Cancelled Successfully ,We have initiated the Refund of ";
    22572280  $refundamtqty = $result[0]->refund_amount * $item['quantity'];
    22582281   $refundamt = number_format((float)$refundamtqty, 2, '.', '');
     
    22632286          return $name." ".$term." Months"; 
    22642287      }else{
    2265           return $name." ".$term." Months ".$cancelButton." <br> ".$refundtxt." <b>"."$".$refundamt." </b>";
     2288          return $name." ".$term." Months ".$cancelButton." <br> <span class='contract-refund-text'>".$refundtxt.$this->get_currency_symbol().$refundamt."</span>";
    22662289      }
    22672290
     
    22782301          return $name." ".$term." Months ".$cancelButton." <br> ".$refundtxt; 
    22792302      }
    2280     }
    2281 
    2282  else {
     2303     
     2304    } else {
    22832305   
    2284     $results = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT * FROM quickcover_contract" ) );
    2285     $order_id = array();
    2286    
    2287     foreach ($results as $key => $value) {
    2288      $order_id[] = $value->order_id;
    2289    }
    2290    $orderIDs = array_unique($order_id);
     2306    $results = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT * FROM quickcover_contract WHERE order_id=".$productOrderId) );
    22912307   
    2292    if (in_array($productOrderId, $orderIDs)){
    2293    $cancelButton = "<button class='cancelContract' id=".$item_quantity." style='display: block; padding: 5px 10px; font-size: 13px; border: none; background: #009688; font-family: sans-serif; float: right; margin-right: 320px' data-orderId=".$productOrderId." data-lineItemID=".$lineItemId." data-cancelby='customer'> Cancel ".$pnamecustomer."</button>";
     2308   if (!empty($results)){
     2309   $cancelButton = "<button class='cancelContract' id=".$item_quantity." style='display: block; padding: 5px 10px; font-size: 13px; border: none; background: #009688; font-family: sans-serif; float: right; margin-right: 30%' data-orderId=".$productOrderId." data-lineItemID=".$lineItemId." data-cancelby='customer'> Cancel ".$pnamecustomer."</button>";
    22942310
    22952311     if (($isOrderreceived !== false) && ($isOrderreceived > 0)) {
     
    23442360        $storeId = $result[0]->store_id; 
    23452361
    2346       $url = 'https://api.quickcover.me/v1/contracts/outlet/'.$storeId.'/cancel';
     2362       $base_url = AfterInc::API_BASE_URL;
     2363       $url = $base_url.'contracts/outlet/'.$storeId.'/cancel';
    23472364
    23482365      $args = array(
     
    24252442   /*add button order details page in admin side and cancel order functionality */
    24262443function woocommerce_before_order_itemmeta($item_id, $item, $product){
    2427 
    2428   $planname = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty")); 
    2429   $pnameadmin = $planname[0]->planname;
    2430 
     2444   
    24312445    $productOrderId = $item['order_id'];
    24322446    $order = wc_get_order( $productOrderId );
     
    24362450    $product_id = $item['product_id'];
    24372451    $item_warrantys = $item->get_meta_data();
     2452   
     2453    $warrantyData = $this->wpdb->get_results( $this->wpdb->prepare("SELECT * FROM product_warranty WHERE product_id=".$product_id)); 
     2454    $pnameadmin = $warrantyData[0]->pname;
     2455   
    24382456   foreach ($item_warrantys as $key => $item_warranty) {
    24392457     if(isset($item_warranty->key) && ($item_warranty->key == '_warranty')){
     
    24572475      $refundamtqty = $results[0]->refund_amount * $item['quantity'];
    24582476      $refundamt = number_format((float)$refundamtqty, 2, '.', '');
    2459       echo '<p><button type="button" class="btn button-primary" data-orderId="'.esc_attr($productOrderId).'" data-lineItemID ="'.esc_attr($lineItemId).'" disabled=true style="cursor: not-allowed;">Cancelled '.esc_attr($pnameadmin).'</button></p><b>Cancelled By : '.esc_attr($results[0]->contract_canceled_by).'<b> <br>Contract has been cancelled successfully,We have initiated the <b>Refund of '. ' $'.esc_attr($refundamt);
     2477      echo '<p><button type="button" class="btn button-primary" data-orderId="'.esc_attr($productOrderId).'" data-lineItemID ="'.esc_attr($lineItemId).'" disabled=true style="cursor: not-allowed;">Cancelled '.esc_attr($pnameadmin).'</button></p><b>Cancelled By : '.esc_attr($results[0]->contract_canceled_by).'<b> <br>Contract has been cancelled successfully,We have initiated the <b>Refund of '.$this->get_currency_symbol().esc_attr($refundamt);
    24602478     }else if(isset($results[0]->contract_status) && $results[0]->contract_status == '250' && $results[0]->refund_amount !=''){
    24612479      echo '<p><button type="button" class="btn button-primary" data-orderId="'.esc_attr($productOrderId).'" data-lineItemID ="'.esc_attr($lineItemId).'" disabled=true style="cursor: not-allowed;">Cancelled '.esc_attr($pnameadmin).'</button></p><b><br>Cancel Request outside the cancel period,Please contract Administrator';
     
    27912809               $storeId = $result[0]->store_id;
    27922810             
    2793              $url = 'https://api.quickcover.me/v1/orders/outlet/'.$storeId;
     2811              $base_url = AfterInc::API_BASE_URL;
     2812              $url = $base_url.'orders/outlet/'.$storeId;
    27942813           
    27952814             $args = array(
  • afterinc-app/trunk/assets/js/afterinc-customer.js

    r2859737 r2865279  
    8383                          var qprice = parseFloat(re.res);
    8484                          var total = (parseFloat(qprice*quantity)).toFixed(2);
     85                          var crnSymbol = parseFloat(re.currency_symbol);
    8586                          swal({
    8687                                title: "Success",
    87                                 text: "Contract has been cancelled successfully, We have initiated the refund of $"+total,
     88                                text: "Contract has been cancelled successfully, We have initiated the refund of "+crnSymbol+total,
    8889                                icon: "success",
    8990                                button: "Ok",
     
    153154            success: function(response) {
    154155              var exist = jQuery('.woocommerce-variation-price .price ins .woocommerce-Price-amount bdi');
    155                var respprice = parseFloat(response).toFixed(2);
     156              var arrData = JSON.parse(response);
     157              var respprice = parseFloat(arrData.totalPrice).toFixed(2);
     158              var crnSymbol = arrData.currency_symbol;
     159             
    156160              if(exist.length){
    157                 jQuery('.woocommerce-variation-price .price ins .woocommerce-Price-amount bdi').text("$"+respprice);
     161                jQuery('.woocommerce-variation-price .price ins .woocommerce-Price-amount bdi').html(crnSymbol+respprice);
    158162              }else{
    159                 jQuery('.price .woocommerce-Price-amount bdi').text("$"+respprice);
     163                jQuery('.price .woocommerce-Price-amount bdi').html(crnSymbol+respprice);
    160164              }
    161165             
  • afterinc-app/trunk/readme.txt

    r2862590 r2865279  
    77Requires PHP: 7.2
    88WC tested up to: 5.6.0
    9 Stable tag: 3.8.4
     9Stable tag: 3.8.5
    1010License: GPLv3
    1111License URI: https://www.afterinc.com
Note: See TracChangeset for help on using the changeset viewer.