Skip to content

Commit

Permalink
Update class.gateway.php
Browse files Browse the repository at this point in the history
  • Loading branch information
maukoese authored Jun 13, 2022
1 parent 03dbdb7 commit e118d93
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions class.gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct()
$this->title = $this->get_option('title');
$this->description = $this->get_option('description');
$this->instructions = $this->get_option('instructions', $this->description);
$this->merchant = $this->get_option('merchant_id');
$this->vendor = $this->get_option('vendor_id');
$this->api_key = $this->get_option('api_key');
$this->api_secret = $this->get_option('api_secret');
$this->api_url = $this->get_option('api_url');
Expand Down Expand Up @@ -86,10 +86,10 @@ public function init_form_fields()
'default' => __('Pay via Selcom Gateway', 'rcpro'),
'desc_tip' => true,
),
'merchant' => array(
'title' => __('Merchant ID', 'rcpro'),
'vendor' => array(
'title' => __('Vendor', 'rcpro'),
'type' => 'text',
'description' => __('Merchant ID provided by Selcom.', 'rcpro'),
'description' => __('Vendor ID provided by Selcom.', 'rcpro'),
'default' => '',
'desc_tip' => true,
),
Expand Down Expand Up @@ -178,7 +178,7 @@ public function create_order(WC_Order $order, $phone, $timestamp)
"utilityref" => $order->get_id(),
"transid" => $order->get_order_key(),
"amount" => round($order->get_total()),
"vendor" => $this->merchant,
"vendor" => $this->vendor,
"order_id" => $order->get_id(),
"buyer_email" => $order->get_billing_email(),
"buyer_name" => $order->get_billing_first_name() . " " . $order->get_billing_last_name(),
Expand All @@ -188,7 +188,7 @@ public function create_order(WC_Order $order, $phone, $timestamp)
);

$authorization = base64_encode($this->api_key);
$signed_fields = implode(',', array_keys($this->min_order));
$signed_fields = implode(',', array_keys($request));
$digest = $this->compute_signature($request, $signed_fields, $timestamp, $this->api_secret);

return $this->send_api_request(
Expand All @@ -209,7 +209,7 @@ public function create_order(WC_Order $order, $phone, $timestamp)
*/
public function process_payment($order_id)
{
$phone = "255" . substr(sanitize_text_field($_POST['phone']), 1);
$phone = "255" . substr(sanitize_text_field(trim($_POST['phone'])), 1);
$order = wc_get_order($order_id);
$timestamp = date('c');
$create_order = $this->create_order($order, $phone, $timestamp);
Expand Down

0 comments on commit e118d93

Please sign in to comment.