/*
* Plugin Name: PayXay - Payment gateway for Woocommerce
* Plugin URI: https://www.payxaf.com/plug-in/pauxaf-payment-gateway/
* Description: This plugin uses PayXaf API for mobile money payment systems.
* Author: Payxaf
* Author URI: https://www.payxaf.com/
* Version: 0.0.1
* License URL: http://www.gnu.org/licenses/gpl-2.0.txt
*/
/*
* This action hook registers our PHP class as a WooCommerce payment gateway
*/
/**
* Try to prevent direct access data leaks
*/
if (!defined('ABSPATH')) exit;
/**
* Check if WooCommerce is present and active
**/
if (!in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) return;
/**
* Add Payxaf to WooCommerce available gateways
* @param array $gateways all available WooCommerce gateways
* @return array $gateways all WooCommerce gateways + Payxaf gateway
*/
function payxaf_add_to_woocommerce(array $gateways): array
{
$gateways[] = 'Payxaf_Woocommerce_Gateway';
return $gateways;
}
add_filter('woocommerce_payment_gateways', 'payxaf_add_to_woocommerce');
/**
* Called when the plugin loads
*/
function payxaf_gateway_init()
{
class Payxaf_Woocommerce_Gateway extends WC_Payment_Gateway
{
const ID = 'pay_xaf';
const API_URL = 'https://www.payxaf.com/';
const SERVER_IP = '15.236.140.89';
const CURRENCIES = ['XAF', 'EUR'];
const SUPPORTED_CURRENCIES = ['XAF' => 1, 'XOF' => 1, 'EUR' => 650, 'USD' => 550];
/**
* @var string
*/
private $public_key;
/**
* @var string
*/
private $secret_key;
/**
* @var string
*/
private $success_url;
/**
* @var bool
*/
private $autocomplete_orders;
/**
* Constructor for the gateway.
*/
public function __construct()
{
// The global ID for this Payment method
$this->id = self::ID;
// This basically defines your settings which are then loaded with init_settings()
$this->init_form_fields();
// After init_settings() is called, you can get the settings and load them into variables
$this->init_settings();
// Boolean. Can be set to true if you want payment fields to show on the checkout
$this->has_fields = false;
// Image to be displayed to the user
$image_url = $this->get_image_url();
// check if Payxaf icon image exists or not
if (@getimagesize($image_url)) {
//Show an image on the frontend
$this->icon = $image_url;
}
// Payment method name for order details and emails
$this->title = "Payxaf";
// Payment method name for admin pages
$this->method_title = "Payxaf - Payment Gateway for WooCommerce";
// The description for this Payment Gateway, shown on the actual Payment options page on the backend
$this->method_description = __(
"Secured payments made simple - designed exclusively for WooCommerce stores. Accept mtn mobile money, Orange money, credit cards, debit cards, and other popular payment methods. allows customers to conveniently checkout using our secure payment gateway",
self::ID
);
// Define user set variables
$this->order_button_text = $this->get_option('order_button_text');
$this->description = $this->get_option('description');
$this->public_key = $this->get_option('public_key');
$this->secret_key = $this->get_option('secret_key');
$this->success_url = $this->get_option('success_url');
$this->autocomplete_orders = $this->get_option('autocomplete_orders') === 'yes';
// Used to perform plugin information updated by the admin
add_action('woocommerce_update_options_payment_gateways_' . $this->id, [$this, 'process_admin_options']);
}
/**
* Generates a callback url only once
*/
private function generate_success_url()
{
if (!$this->get_option('success_url')) {
$this->update_option(
'success_url',
get_home_url() . '/wp-json/callback/' . md5(uniqid() . mt_rand())
);
}
}
/**
* Image to be displayed to the user
*/
private function get_test_mode(): string
{
$test_mode = $this->get_option('test_mode');
$url = '';
if ($test_mode === 'sand_box')
$url = 'https://app.payxaf.com/sandbox/payment/initiate';
else if ($test_mode === 'live')
$url = 'https://app.payxaf.com/payment/initiate';
return $url;
}
/**
* Image to be displayed to the user
*/
private function get_checkout_theme(): string
{
$checkout_theme = $this->get_option('dark');
$theme = '';
if ($checkout_theme === 'dark')
$theme = 'dark';
else if ($checkout_theme === 'light')
$theme = 'light';
return $theme;
}
/**
* Image to be displayed to the user
*/
private function get_image_url(): string
{
$payment_methods = $this->get_option('payment_methods');
$image = 'payxaf_operators.png';
if ($payment_methods === 'mobile')
$image = 'payxaf_momo_om.png';
else if ($payment_methods === 'credit_card')
$image = 'payxaf_visa_master.png';
return WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/images/' . $image;
}
/**
* Initializes gateway settings form
*/
public function init_form_fields()
{
// Generate a callback url
$this->generate_success_url();
$this->form_fields = apply_filters(
'payxaf_form_fields',
[
'enabled' => [
'title' => __('Enable/Disable', self::ID),
'type' => 'checkbox',
'label' => __('Enable Payxaf', self::ID),
'description' => __('Check to enable this plugin', self::ID),
'default' => 'yes',
'desc_tip' => true,
],
'test_mode' => [
'title' => __('Enabled live or test environment', self::ID),
'type' => 'select',
'description' => __('Use this payment gateway in test/sandbox mode, when testing the plugin. The tesing credentials are: Test Mode eMail: test_mode@mail.com Test Mode Verification Code: 222666', self::ID),
'default' => "sandbox",
'options' => [
"sand_box" => __("Sandbox", self::ID),
"live" => __("Live", self::ID),
],
'desc_tip' => true,
],
'checkout_theme' => [
'title' => __('Select the the theme on the checkout of your shop.', self::ID),
'type' => 'select',
'description' => __('Choose either a dark or light theme for the checkout form.', self::ID),
'default' => "sandbox",
'options' => [
"sand_box" => __("Sandbox", self::ID),
"live" => __("Live", self::ID),
],
'desc_tip' => true,
],
'success_url' => [
'title' => __('Callback URL', self::ID),
'type' => 'hidden',
'description' => __('Copy the URL below and paste it in settings of your application in Payxaf
' . $this->get_option('success_url') . '
', self::ID),
],
'description' => [
'title' => __('Description', self::ID),
'type' => 'textarea',
'description' => __('Payment method description, visible by customers on your checkout page', self::ID),
'default' => __('Pay safely using Orange Money, MTN Mobile Money, VISA, MasterCard or Payxaf Wallet', self::ID),
'desc_tip' => true,
],
'public_key' => [
'title' => __('Public key', self::ID),
'type' => 'text',
'description' => __('Copy and paste the public key from your mechant account on Payxaf', self::ID),
'default' => '',
'desc_tip' => true,
],
'secret_key' => [
'title' => __('Secret key', self::ID),
'type' => 'text',
'description' => __('Copy and paste the secret key from your mechant account on Payxaf', self::ID),
'default' => '',
'desc_tip' => true,
],
'payment_methods' => [
'title' => __('Enabled payment methods', self::ID),
'type' => 'select',
'description' => __('This will change operators logos displayed on your checkout page', self::ID),
'default' => "all",
'options' => [
"all" => __("All", self::ID),
"mobile" => "Mobile Money (OM + MoMo)",
"credit_card" => __("Credit Card (VISA + MasterCard)", self::ID),
],
'desc_tip' => true,
],
'order_button_text' => [
'title' => __('Payment button text', self::ID),
'type' => 'text',
'description' => __('Text of the payment button on which customers click to make the payment', self::ID),
'default' => __('Pay with Payxaf', self::ID),
'desc_tip' => true,
],
'currency' => [
'title' => __('Payxaf currency', self::ID),
'type' => 'select',
'description' => __('This is the currency that your customers will see on payment page. If you choose Euro, only card payment will be available on payment page', self::ID),
'default' => "default",
'options' => [
"default" => __("Same as on WooCommerce", self::ID),
"XAF" => "CFA Franc (FCFA)",
"EUR" => __("Euro (€)", self::ID),
"USD" => __("Dollar ($)", self::ID),
],
'desc_tip' => true,
],
'autocomplete_orders' => array(
'title' => __('Autocomplete orders', self::ID),
'label' => __('Autocomplete orders on payment success', self::ID),
'type' => 'checkbox',
'description' => __('If enabled, orders statuses will go directly to complete after successful payment', self::ID),
'default' => 'no',
'desc_tip' => true,
),
]);
}
public function get_public_key(): string
{
return $this->public_key;
}
public function get_secret_key(): string
{
return $this->secret_key;
}
public function get_success_url(): string
{
return $this->success_url;
}
public function get_autocomplete_orders(): bool
{
return $this->autocomplete_orders;
}
/**
* Get order amount and currency for Payxaf
* @throws Exception
*/
private function get_order_amount_currency(WC_Order $order): array
{
$woocommerce_currency = get_woocommerce_currency();
// Throws an exception when currency is not defined in PAYXAF_CURRENCIES
if (!isset(self::SUPPORTED_CURRENCIES[$woocommerce_currency]))
throw new Exception("Currency '$woocommerce_currency' is not currently supported. Please, try using one of the following: " . implode(', ', array_keys(self::SUPPORTED_CURRENCIES)));
$currency = $this->get_option('currency');
if (!in_array($currency, self::CURRENCIES))
$currency = $woocommerce_currency;
$amount = $order->get_total();
if ($currency !== $woocommerce_currency)
$amount *= self::SUPPORTED_CURRENCIES[$woocommerce_currency] / self::SUPPORTED_CURRENCIES[$currency];
return compact('amount', 'currency');
}
/**
* Checks if billing country is CM and billing phone is a valid Mobile Money phone
*/
private function is_order_from_cameroon(WC_Order $order): bool
{
return $order->get_billing_country() === 'CM'
&& preg_match(
'/^((\+|00)?237)?6[5789][0-9]{7}$/',
preg_replace('/[^0-9]/', '', $order->get_billing_phone()) // Ignore non numeric
);
}
/**
* Returns user's locale
*/
private function get_locale(): string
{
return strpos('fr_FR', get_locale()) != false ? 'fr' : 'en';
}
/**
* This function handles the processing of the order, telling WooCommerce
* what status the order should have and where customers go after it’s used.
*/
public function process_payment($order_id)
{
global $woocommerce;
$order = new WC_Order( $order_id );
// Mark as on-hold (we're awaiting the cheque)
$order->update_status('on-hold', __( 'Awaiting cheque payment', 'woocommerce' ));
//$order = wc_get_order($order_id);
/* try {
$order_desc = implode(
', ',
array_map(
function (WC_Order_Item $item) {
return $item->get_name();
},
$order->get_items()
)
); */
$amount_currency = $this->get_order_amount_currency($order);
$body = [
"transaction_amount" => $amount_currency['amount'],
"transaction_currency" => $amount_currency['currency'],
"transaction_reason" => substr($order_desc, 0, 255), // Get first 255 chars
"app_transaction_ref" => $order->get_order_key(),
"customer_name" => $order->get_formatted_billing_full_name(),
"customer_email" => $order->get_billing_email(),
"customer_lang" => $this->get_locale()
];
if ($this->is_order_from_cameroon($order))
$body['customer_phone_number'] = preg_replace('/[^0-9]/', '', $order->get_billing_phone()); // Ignore non numeric
$mode = get_test_mode(); //<------------ Change to TEST for test server, PROD for production-->
/* $parameters = [
'identifier' => $identifier,
'currency' => $currency,
'amount' => $amount,
'details' => $details,
'ipn_url' => $ipn_url,
'cancel_url' => $cancel_url,
'success_url' => $success_url,
'payxaf_public_key' => $payxaf_public_key,
'site_logo' => $site_logo,
'checkout_theme' => $checkout_theme,
'customer_name' => $customer_name,
'customer_email' => $customer_email,
];
*/
$url = get_test_mode();
// Get payment link from Payxaf
$result = wp_remote_post($url, array(
/* str_replace('{public_key}', $this->public_key, self::API_URL),
["body" => $body, "sslverify" => false] */ //byme
// Passing variables from form page
$identifier = uniqid(),
$payxaf_public_key = "get_public_key()",
$site_logo= "https://app.payxaf.com/assets/images/logoIcon/logo.png",
$checkout_theme = "get_checkout_theme()",
$currency = $this->get_option('currency'),
$amount = $this->get_option('amount'),
$details = "testing",
$ipn_url = "www.one.com",
$cancel_url = "www.two.com",
$success_url = "www.three.com",
$customer_name = $order->get_formatted_billing_full_name(),
$customer_email = $order->get_billing_email(),
));
if(!is_wp_error($result))
{
$response_body = wp_remote_retrieve_body($result);
$resp_array = json_decode($response_body);
if(isset($resp_array->status))
return $resp_array->status;
if(!isset($resp_array->status) && isset($resp_array->message))
return; //wc_add_notice( $resp_array->message, 'error' ); by me
}
else
wc_add_notice( 'Failed to initiate transaction please try again later', 'error' );
}
/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch); */
//$result contains the response back.
//echo $result;
/*$_SESSION['result'] = $result;
$data = json_decode($result, false);
$success = $data->success;
$_SESSION['success'] = $success;
$_SESSION['details'] = $details;
$_SESSION['identifier'] = $identifier;
$_SESSION['currency'] = $currency;
$_SESSION['amount'] = $amount; */
//echo $success;
//echo $details;
// $data = json_decode( $resul, false);
// $success = $data->success;
// header("Location: $data->url");
// echo $result;
// Get raw response
/// $raw_response = wp_remote_retrieve_body($result);
// Parse response
/* $response = json_decode($raw_response, true);
if (!(isset($response["success"]) && $response["success"] === "ok")) {
throw new Exception($response["message"] ?? "An error has occurred. Please try again later");
} else { /*
$order->set_transaction_id($response['message']);
$order->add_order_note('Payxaf payment initiated with reference: ' . $response['message']);
// Clear cart
WC()->cart->empty_cart();
return [
'result' => 'success',
'redirect' => $response['payment_url']
]; */
} /* catch (Exception $ex) {
$order->add_order_note("Payxaf payment init failed with message: " . $ex->getMessage());
wc_add_notice(__('Payment error : ', 'woothemes') . $ex->getMessage(), 'error');
if (isset($result)) {
payxaf_log_data('Request <-----');
payxaf_log_data($result);
}
if (isset($raw_response)) {
payxaf_log_data('Raw response <-----');
payxaf_log_data($raw_response);
}
if (isset($response)) {
payxaf_log_data('Response <-----');
payxaf_log_data($response);
}
return;
} */
}
// }
/* ============================================ INCLUDE OTHER FILE =========================================== */
// including the callback
include 'include/payxaf_callback.php';
// including the order_key in wc admin order list
include 'include/payxaf_hooks.php';
/*=========================================================================================================== */
//}
add_action('plugins_loaded', 'payxaf_gateway_init', 0);
National Advanced School of Public Works (ENSTP) Competitive Exams – 2022/2023 – Concours – OCASET – Online Centre for Art Sciences Engineering and Technology
National Advanced School of Public Works (ENSTP) Competitive Exams – 2022/2023 – Concours
National Advanced School of Public Works (ENSTP) Competitive Exams – 2022/2023 – Concours
National Advanced School of Public Works (ENSTP) Exams – 2022/2023
The Minister of State, Minister for Higher Education and the Minister for Public Works inform the general public that the 2022/2023 Competitive Entrance Examination into the National Advanced School of Public Works (ENSTP) Yaounde and Buea Annex has been launched in the following areas :.
Le Ministre d’Etat, Ministre de l’Enseignement Supérieur et le Ministre des Travaux Publics informent le public qu’ils organisent pour le compte de l’année académique 2022/2023 des concours d’entrée à l’Ecole Nationale Supérieure des Travaux Publics de Yaoundé et de son annexe de Buea suivant le planning ci-dessous :
NASPW provides the initial training of Engineers of Works of Civil Engineering, Rural Engineering and Topography and Surveying (BAC+3level) in Yaounde, the Senior Technicians (BAC +2 level) in Buea in all the options mentioned above. In addition, the training in Yaounde also contains a specialization cycle for management executives.
Yaounde Center
Engineers Managers / Higher Cycle of Management
Cycle of the engineers of works:
– for holders only one of the following degrees ( Baccalaureate C, D, E, F, G.C.E (Al)with mathematics and physics or chemistry obtained in one session.)
– For holders of any other diploma admitted in equivalence by higher education.
Number of places per sector
Civil Engineering: 150 places
Town Planning: 50 places
Rural Engineering: 60 places
Topography-Surveying: 50 places
Candidates for the cycles of engineers of works definitively admitted will not be able to register only on presentation of the originals of the diplomas of baccalaureate (GCE (AL) mentioned above. No candidate who does not hold a baccalaureate diploma (GCE (AL)) may be allowed to register and will be immediately replaced by the candidate on the waiting list.
BUEA Center
Cycle of Technicians (Civil Engineering, Rural Engineering):
200 places for the holders (or subject to obtaining) of a following diploma (Probatoire C, D, E, F, GCE (AL) in at least one subject including mathematics or physics or chemistry, or any other equivalent degree).
Cycle of Senior Technicians in Civil Engineering, Rural Engineering and Topography for holders (or subject to obtaining) a following degree (( Baccalaureate C, D, E, F, G.C.E (Al)with mathematics and physics or chemistry obtained in one session, City and advanced craft certificate, the professional certificate or any other equivalent recognized diploma).
Number of places per sector
Civil Engineering: 60 places
Rural Engineering: 50 places
Topography: 50 places
Application files
The application file includes:
An application form to be withdrawn in one of the examination centers (1) and specifying the cycle and option solicited
N.B: the candidate will choose maximun three option in order of priority for the cycle of the Engineers of Works
A certified copy of birth certificate that is less than three months old
A criminal record (B3) that is less than three months old
A certified copy of the diploma corresponding to the cycle requested or a certificate of success
A medical certificate certifying that the candidate is fit for the public works trades
A receipt of payment bearing the name of the candidate to the account of the NASPW-Yaounde n ° 13368063000-93 of the BICEC, agency of the park in yaounde.
Candidates in a city other than Yaounde deposit the contest fees at the BICEC of the city concerned. The transfer fee is attributable to the candidate.
NB: No payment in cash will be made in the different examination centers
A letter of sponsorship for the financing (3) of studies whose model is to be withdrawn at the examination center
A 4 * 4 photo to be stapled on the application form
Authorization to compete (for public officials) issued by the user Minister.
Examination centers
The different examination centers are:
NASPW of Yaounde
NASPW (Annex) of Buea
PWTC of Garoua
Regional Delegations of Public Works except for Limbe, Garoua and Yaounde.
The contest fees for Technicians, Senior Technicians, Engineers of Works rise to 20,000 FCFA.
Content and duration of the tests
cycle Technical Sciences (3h) General Knowledge (1h) Langues(1,5h)
Technicians Mathematics, Pyhsics, Chemistry, News News English for French-speaking candidates;
French for English-speaking candidates
Senior Technicians
Engineers of Works
Cost of training
LNASPW provides the initial training of Engineers of Works of Civil Engineering, Rural Engineering and Topography and Surveying (BAC+3level) in Yaounde, the Senior Technicians (BAC +2 level) in Buea in all the options mentioned above. In addition, the training in Yaounde also contains a specialization cycle for management executives.
Summary table of tuition fees
cycle Amount
Technicians 175.000 FCFA
Senior Technicians 185.000FCFA
Engineer of works 235.000FCFA
EVENT CONTENT
Over 37 lectures and 55.5 hours of content!
LIVE PROJECT End to End Software Testing Training Included.
Learn Software Testing and Automation basics from a professional trainer from your own desk.
Information packed practical training starting from basics to advanced testing techniques.
Best suitable for beginners to advanced level users and who learn faster when demonstrated.
Course content designed by considering current software testing technology and the job market.
Practical assignments at the end of every session.
Practical learning experience with live project work and examples.