Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Adding a custom seller payment method

MultivendorX Pro

Resolved
Viewing 6 reply threads
  • Author
    Posts
    • #189260
      kevajo
      Participant

      I’m trying to add a custom payment method since none of the payment methods in multivendor x are available from us.

      Here is my code.

      First, I created a “class-mvx-gateway-mobile_money.php” file that I added to the root of my child theme.
      Here is the content of file “class-mvx-gateway-mobile_money.php”
      <?php
      /**
      * The template for displaying vendor payment content
      *
      * Override this template by copying it to yourtheme/MultivendorX/vendor-dashboard/vendor-custom-payment-details.php
      *
      * @author Kevajo webmaster
      * @package MVX/Templates
      * @version 2.2.0
      */
      if (!defined(‘ABSPATH’)) {
      exit;
      }

      class MVX_Gateway_Mobile_Money extends MVX_Payment_Gateways {

      public $id;
      public $message = array();
      public $gateway_title;
      public $payment_gateway;

      public function __construct() {
      $this->id = ‘mobile_money’;
      $this->gateway_title = __(‘Mobile Money’, ‘multivendorx’);
      $this->payment_gateway = $this->id;
      //$this->enabled = get_mvx_global_settings(‘payment_method_mobile_money’, ‘payment’);
      $this->enabled = mvx_is_module_active(‘payment_method_mobile_money’) ? ‘Enable’ : ”;
      }

      public function gateway_logo() { global $MVX; return $MVX->plugin_url . ‘assets/images/’.$this->id.’.png’; }

      public function process_payment($vendor, $commissions = array(), $transaction_mode = ‘auto’) {
      $this->vendor = $vendor;
      $this->commissions = $commissions;
      $this->currency = get_woocommerce_currency();
      $this->transaction_mode = $transaction_mode;
      if ($this->validate_request()) {
      $this->record_transaction();
      if ($this->transaction_id) {
      return array(‘message’ => __(‘New transaction has been initiated’, ‘multivendorx’), ‘type’ => ‘success’, ‘transaction_id’ => $this->transaction_id);
      }
      } else {
      return $this->message;
      }
      }

      public function validate_request() {
      global $MVX;
      if ($this->enabled != ‘Enable’) {
      $this->message[] = array(‘message’ => __(‘Invalid payment method’, ‘multivendorx’), ‘type’ => ‘error’);
      return false;
      }

      if ($this->transaction_mode != ‘admin’) {
      /* handel thesold time */
      $threshold_time = get_mvx_global_settings(‘commission_threshold_time’) ? get_mvx_global_settings(‘commission_threshold_time’) : 0;
      if ($threshold_time > 0) {
      foreach ($this->commissions as $index => $commission) {
      if (intval((date(‘U’) – get_the_date(‘U’, $commission)) / (3600 * 24)) < $threshold_time) {
      unset($this->commissions[$index]);
      }
      }
      }
      /* handel thesold amount */
      $thesold_amount = get_mvx_global_settings(‘commission_threshold’) ? get_mvx_global_settings(‘commission_threshold’) : 0;
      if ($this->get_transaction_total() > $thesold_amount) {
      return true;
      } else {
      $this->message[] = array(‘message’ => __(‘Minimum threshold amount for commission withdrawal is ‘ . $thesold_amount, ‘multivendorx’), ‘type’ => ‘error’);
      return false;
      }
      }
      return parent::validate_request();
      }

      }

      Then I put this code in function.php of my child theme.
      Coded :
      // Addition of Mobile money for merchant payment
      add_filter(‘automatic_payment_method’,function( $payment_methods ) {
      $payment_methods[‘mobile_money’] = ‘Mobile Money’;
      return $payment_methods;
      });

      add_filter(‘wcmp_vendor_payment_mode’, ‘payment_mode’);
      function payment_mode( $r ){
      $payment_admin_settings = get_option(‘wcmp_payment_settings_name’);
      if (isset($payment_admin_settings[‘payment_method_mobile_money’]) && $payment_admin_settings[‘payment_method_mobile_money’] = ‘Enable’) {
      $r[‘mobile_money’] = __(‘Mobile money’, ‘multivendorx’);
      }
      return $r;
      }

      add_filter(“settings_vendors_payment_tab_options”, ‘admin_values’, 10 , 2);
      function admin_values( $payment_tab_options, $vendor_obj ){
      $payment_tab_options[‘vendor_mobile_money_name’] = array(‘label’ => __(‘Mobile Money Name’, ‘multivendorx’), ‘type’ => ‘text’, ‘id’ => ‘vendor_mobile_money_name’, ‘label_for’ => ‘vendor_mobile_money_name’, ‘name’ => ‘vendor_mobile_money_name’, ‘value’ => $vendor_obj->mobile_money_name, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);

      $payment_tab_options[‘vendor_mobile_money_type’] = array(‘label’ => __(‘Account type’, ‘multivendorx’), ‘type’ => ‘select’, ‘id’ => ‘vendor_mobile_money_type’, ‘label_for’ => ‘vendor_mobile_money_type’, ‘name’ => ‘vendor_mobile_money_type’, ‘options’ => array(‘orange’ => __(‘Orange’, ‘multivendorx’), ‘mtn’ => __(‘Mtn’, ‘multivendorx’), ‘moov’ => __(‘Moov’, ‘multivendorx’)), ‘value’ => $vendor_obj->mobile_money_type, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);

      $payment_tab_options[‘vendor_mobile_money_number’] = array(‘label’ => __(‘Account type’, ‘multivendorx’), ‘type’ => ‘text’, ‘id’ => ‘vendor_mobile_money_number’, ‘label_for’ => ‘vendor_mobile_money_number’, ‘name’ => ‘vendor_mobile_money_number’, ‘value’ => $vendor_obj->mobile_money_number, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);
      return $payment_tab_options;
      }

      //storing data of vendor mobile money account

      add_filter(‘mvx_vendor_user_fields’,function ($fields,$user_id){
      $vendor = new WCMp_Vendor($user_id);
      $fields[“vendor_mobile_money_name”] = array(
      ‘label’ => __(‘Mobile Money Name’, ‘multivendorx’),
      ‘type’ => ‘text’,
      ‘value’ => $vendor->mobile_money_name,
      ‘class’ => “user-profile-fields regular-text”
      ); // Text
      $fields[“vendor_mobile_money_type”] = array(
      ‘label’ => __(‘Mobile Money Type’, ‘multivendorx’),
      ‘type’ => ‘select’,
      ‘options’ => array(‘orange’ => __(‘Orange’, ‘multivendorx’), ‘mtn’ => __(‘Mtn’, ‘multivendorx’), ‘moov’ => __(‘Moov’, ‘multivendorx’)),
      ‘value’ => $vendor->mobile_money_type,
      ‘class’ => “user-profile-fields regular-text”
      ); // Text
      $fields[“vendor_mobile_money_number”] = array(
      ‘label’ => __(‘Mobile Money Number’, ‘multivendorx’),
      ‘type’ => ‘text’,
      ‘value’ => $vendor->mobile_money_number,
      ‘class’ => “user-profile-fields regular-text”
      ); // Text
      return $fields;
      },10,2);

      //Mobile money
      require_once ‘class-mvx-gateway-mobile_money.php’;
      add_filter(‘mvx_payment_gateways’, ‘add_gateways’);
      function add_gateways($load_gateways){
      $mobile_money = array(‘MVX_Gateway_Mobile_Money’);
      return array_merge( $load_gateways, $mobile_money );
      }

      However, I see an error.
      When I remove this piece of code, the personalized payment method appears in the parameters but without these fields.
      //Mobile money
      require_once ‘class-mvx-gateway-mobile_money.php’;
      add_filter(‘mvx_payment_gateways’, ‘add_gateways’);
      function add_gateways($load_gateways){
      $mobile_money = array(‘MVX_Gateway_Mobile_Money’);
      return array_merge( $load_gateways, $mobile_money );
      }
      Please take a look for me

    • #189272

      Kevajo as you have added a custom payment method , our support team can not help you with that . You can follow the implementation of Razorpay from here https://github.com/multivendorx/mvx-razorpay-split-payment to implement your custom payment method or you can contact our custom development team by sending a mail on custom.dev@multivendorx.com. The team will help you accordingly .

    • #189273
      kevajo
      Participant

      We paid the customization team who worked halfway and refused to complete our work.
      So I have to do it myself.
      Your customization colleagues are at risk of smearing this fine company.

    • #189277

      Kindly get in touch with our team through mail.

    • #189278
      kevajo
      Participant

      Mr.
      We paid for you to make your old customizations compatible with Multivendor X.
      You have provided the estimate and we have proceeded with the payment as our previous payments.
      But by surprise you ignored part of our personalization, we let you know, you asked us to pay again.
      When you first customized your price, we paid over $3000.
      The second customization more than $3500 and again instead of a plugin as in the specification below you provided custom codes in fontion.php of our child theme.

      Third customization $800, to make all customizations compatible with your own code. And I remind you that in the second customization, you were asked that the code be compatible with multivendor x.

      You are not serious in asking us to pay again.
      We’ve always been honest and if you really care about God you’ll be on our side.

      You cannot ask us to pay again for work that should have been done since the second customization.

      But alas, let’s observe.

    • #189279
      kevajo
      Participant

      In addition to all these customizations made by your , you dare to tell us that the customization teams that made the first customization, the second and the last are not the same.
      We are not responsible for everything, a team must be a continuity.
      We paid for all of its customizations so you have to do your job; you tell us about several projects that you manage, but we paid and the work is not done.

      Nb: the only effective and respectful team to those of the support.

    • #189288

      Sorry for the inconvenience . Kindly get in touch with our custom team by sending a mail on custom.dev@multivendorx.com .

Viewing 6 reply threads

The topic ‘Adding a custom seller payment method’ is closed to new replies.