Model/Resource/MobilePayment.php
public function charge($data) {

        // JSON post data to object
        $this->data = json_decode($data);

        // Load the customer from email
        $this->customer = $this->customerRepository->get(filter_var($this->data->email, FILTER_SANITIZE_EMAIL));    
        // If customer exists and amount is valid
        if ( (int) $this->customer->getId() > 0 && (float) $this->data->value > 0)  {

            // Prepare the product list
            if ( isset($this->data->products) && is_array($this->data->products) && count($this->data->products) > 0 )  {

                // Submit request
                return (int) $this->submitRequest();
            }
        }

        return false;
    }
public function charge($data) {

        // JSON post data to object
        $this->data = json_decode($data);

        // Load the customer from email
        $this->customer = $this->customerRepository->get(filter_var($this->data->email, FILTER_SANITIZE_EMAIL));    
        // If customer exists and amount is valid
        if ( (int) $this->customer->getId() > 0 && (float) $this->data->value > 0)  {

            // Prepare the product list
            if ( isset($this->data->products) && is_array($this->data->products) && count($this->data->products) > 0 )  {

                // Submit request
                return (int) $this->submitRequest();
            }
        }

        return false;
    }
public function charge ( $ data ) { // JSON post data to object $ this -> data = json_decode ( $ data ) ; // Load the customer from email $ this -> customer = $ this -> customerRepository -> get ( filter_var ( $ this -> data -> email , FILTER_SANITIZE_EMAIL ) ) ; // If customer exists and amount is valid if ( ( int ) $ this -> customer -> getId ( ) > 0 && ( float ) $ this -> data -> value > 0 ) { // Prepare the product list if ( isset ( $ this -> data -> products ) && is_array ( $ this -> data -> products ) && count ( $ this -> data -> products ) > 0 ) { // Submit request return ( int ) $ this -> submitRequest ( ) ; } } return false ; }
Perfom a charge given the required parameters.

@api
@param mixed $data.
@return int.
Perfom a charge given the required parameters .