Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Egregius committed Feb 2, 2021
1 parent 3eedd64 commit 5cb7511
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions netpay-payments-for-woocommerce/netpay-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Xafax Belgium, Guy Verschuere
* Author URI: https://www.xafax.be
* Text Domain: netpay-payments-for-woocommerce
* Version: 0.7
* Version: 0.8
* Requires at least: 5.3
* Requires PHP: 7.0
*
Expand Down Expand Up @@ -137,47 +137,45 @@ public function validate_fields(){
}
return true;
}
public function process_payment( $order_id ) {
public function process_payment($order_id) {
global $woocommerce;
$order=wc_get_order( $order_id);
$order=wc_get_order($order_id);
$orderdata=json_decode($order, true);
$body=array(
'apikey'=>$this->settings['apikey'],
'authentication'=>$this->settings['authentication'],
'paymentmethod'=>$this->settings['paymentmethod'],
'deviceid'=>$this->settings['deviceid'],
'comment'=>$this->settings['comment'],
'orderid'=>$orderdata['id'],
'amount'=>$orderdata['total']
);
if ($this->settings['authentication']=='userpassword') {
$body['username']=$_POST[ 'netpay_username' ];
$body['password']=$_POST[ 'netpay_password' ];
} elseif ($this->settings['authentication']=='cardid') {
$body['cardid']=$_POST[ 'netpay_cardid' ];
}
if ($this->settings['paymentmethod']=='recordplu') {
if ($this->settings['paymentmethod']=='writebalance') {
$body['comment']=$this->settings['comment'];
$body['amount']=$orderdata['total'];
} elseif ($this->settings['paymentmethod']=='recordplu') {
$order_items=$order->get_items( array('line_item', 'fee', 'shipping') );
foreach ( $order->get_items() as $item_id => $item ) {
$i['product_id']=$item->get_product_id();
$i['variation_id']=$item->get_variation_id();
//$i['variation_id']=$item->get_variation_id();
$i['product']=$item->get_product();
$i['name']=$item->get_name();
$i['quantity']=$item->get_quantity();
$i['subtotal']=$item->get_subtotal();
$i['total']=$item->get_total();
//$i['total']=$item->get_total();
$i['tax']=$item->get_subtotal_tax();
$i['taxclass']=$item->get_tax_class();
$i['taxstat']=$item->get_tax_status();
$i['allmeta']=$item->get_meta_data();
$i['type']=$item->get_type();
//$i['taxclass']=$item->get_tax_class();
//$i['taxstat']=$item->get_tax_status();
//$i['allmeta']=$item->get_meta_data();
//$i['type']=$item->get_type();
$items[]=$i;
}
$body['items']=$items;
}
$args=array(
'method'=>'POST',
'timeout'=>20,
'timeout'=>30,
'redirection'=>5,
'httpversion'=>'1.0',
'blocking'=>true,
Expand Down Expand Up @@ -220,15 +218,18 @@ public function webhook() {
function check_for_plugin_update($checked_data) {
global $api_url, $plugin_slug, $wp_version;
// if (empty($checked_data->checked)) return $checked_data;
$plugin_info=get_site_transient('update_plugins');
$current_version=$plugin_info->checked[$plugin_slug .'/'. $plugin_slug .'.php'];
$args=array(
'slug' => $plugin_slug,
'version' => $checked_data->checked[$plugin_slug .'/'. $plugin_slug .'.php'],
'version' => $current_version,
);
$request_string=array(
'body' => array(
'action' => 'basic_check',
'request' => serialize($args),
'url' => get_bloginfo('url'),
'version'=>$current_version,
'wp_version' => $wp_version
),
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url')
Expand All @@ -250,6 +251,7 @@ function plugin_api_call($def, $action, $args) {
'action' => $action,
'request' => serialize($args),
'url' => get_bloginfo('url'),
'version'=>$current_version,
'wp_version' => $wp_version
),
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url')
Expand Down

0 comments on commit 5cb7511

Please sign in to comment.