Plugin Directory

Changeset 2883301


Ignore:
Timestamp:
03/20/2023 08:49:50 AM (3 years ago)
Author:
sprintlogistics
Message:

create api for update waybills status

Location:
sprint/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sprint/trunk/includes/Ajax/ERP_SPRINT_Ajax_Service.php

    r2792272 r2883301  
    8484                  )
    8585              );
    86      
     86
     87    add_action( 'rest_api_init', function () {
     88      register_rest_route( 'sprint/v1/', '/waybill_update', array(
     89        'methods' => 'GET, POST',
     90        'callback' => array($this,'erp_sprint_update_waybill'),
     91      ));
     92    });
     93  }
     94 
     95  public function erp_sprint_update_waybill($req) {
     96    $waybillNumber = $req['waybillNumber'];
     97    $status = $req['status'];
     98    global $wpdb;
     99    $data = $this->erp_pudo_get_setting_array();
     100    $logixgrid_setting = $wpdb->get_row("SELECT * FROM wp_logixgridwaybillSecureKey WHERE waybill_number = '". $waybillNumber ."' and secure_key = '".$data['secureKey']."'",ARRAY_A );
     101    if (count($logixgrid_setting) > 0) {
     102      $id = $logixgrid_setting['ID'];
     103      $waybill_status = $logixgrid_setting['waybill_status'];
     104      $get_status = unserialize($waybill_status);
     105      $status = serialize(array($status));
     106      $result = $wpdb->update( 'wp_logixgridwaybillSecureKey', array( 'waybill_status' => $status ),array('ID' => $id));
     107      $data = array('result' => 'Success', 'messageType'=>'Status is updated successfully');
     108    } else {
     109      $data = array('result' => 'Error', 'messageType'=>'Waybill doesn\'t not exits');
     110    }
     111    return $data;
    87112  }
    88113
  • sprint/trunk/sprint.php

    r2794821 r2883301  
    1212Author URI: https://logixgrid.com/
    1313Package: Sprint
    14 Version: 2.5
     14Version: 3.5
    1515Text Domain: Sprint-for-wooCommerce
    1616Requires at least: 1.0
Note: See TracChangeset for help on using the changeset viewer.