Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kendysond committed May 28, 2017
1 parent df2fbb0 commit 84795c9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 50 deletions.
51 changes: 18 additions & 33 deletions mod_spc_paystack/helper.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
<?php
/**
* @package JJ Module Generator
* @author JoomJunk
* @copyright Copyright (C) 2011 - 2012 JoomJunk. All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* Helper for mod_login
*
* @package Joomla.Site
* @subpackage mod_login
*
* @since 1.5
*/

class ModSpcPaystackHelper{

public static function getAjax(){
Expand All @@ -34,14 +20,7 @@ public static function getAjax(){
return $result;

}
/**
* Retrieve the url where the user should be returned after logging in
*
* @param \Joomla\Registry\Registry $params module parameters
* @param string $type return type
*
* @return string
*/
//Generate Transaction Reference
public static function generate_new_code($length = 10){
$characters = '06EFGHI9KL'.time().'MNOPJRSUVW01YZ923234'.time().'ABCD5678QXT';
$charactersLength = strlen($characters);
Expand Down Expand Up @@ -78,6 +57,8 @@ public static function generate_code(){

return $code;
}
//Initialize payment

public static function initializePayment($units){
$user = JFactory::getUser();
if (!$user->guest){
Expand Down Expand Up @@ -130,11 +111,8 @@ public static function initializePayment($units){
return $row;
}

/**
* Returns the current users type
*
* @return string
*/
//Verify Payment

public static function verifyPayment($reference)
{
$result = array( );
Expand Down Expand Up @@ -174,6 +152,8 @@ public static function verifyPayment($reference)
return $result;

}
//Get Module Params

public static function getParams()
{
// $user = JFactory::getUser();
Expand All @@ -185,6 +165,8 @@ public static function getParams()


}
//Give units to customer


public static function giveUnits($tx,$response)
{
Expand Down Expand Up @@ -225,6 +207,8 @@ public static function giveUnits($tx,$response)


}
//Get customer balance

public static function getBalance($user = null)
{

Expand All @@ -246,6 +230,8 @@ public static function getBalance($user = null)


}
//Generate Multiplier for units

public static function getMultiplier($amount)
{
$singlemultiplier = 1;
Expand All @@ -261,6 +247,8 @@ public static function getMultiplier($amount)


}
//Get all multipliers

public static function getMultipliers()
{

Expand Down Expand Up @@ -299,11 +287,8 @@ public static function getMultipliers()

}

/**
* Get list of available two factor methods
*
* @return array
*/
//Verify transaction was successful on Paystack

public static function verifyTransaction($reference)
{
$params = ModSpcPaystackHelper::getParams();
Expand Down
9 changes: 1 addition & 8 deletions mod_spc_paystack/mod_spc_paystack.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
<?php
/**
* @package SpcPaystack
* @author DouglasKendyson
* @copyright Copyright2017-Paystack
* @license GNUGeneralPublicLicenseversion2orlaterseeLICENSE.txt
**/

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Include the login functions only once
require_once __DIR__ . '/helper.php';

$doc = JFactory::getDocument();
Expand Down Expand Up @@ -98,6 +90,7 @@
})(jQuery)
JS;
$doc->addScriptDeclaration($js);

require JModuleHelper::getLayoutPath('mod_spc_paystack');

?>
4 changes: 2 additions & 2 deletions mod_spc_paystack/mod_spc_paystack.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://github.com/kendysond</authorUrl>
<version>1.0</version>
<description>SPCforPaystack</description>
<description>Paystack module for SPC</description>

<files>
<filename module="mod_spc_paystack">mod_spc_paystack.php</filename>
Expand All @@ -20,7 +20,7 @@
<config>
<fields name="params">
<fieldset name="basic">
<field name="paystack_mode" type="radio" label="Mode" default="1" description="Paystack mode">
<field name="paystack_mode" type="radio" label="Mode" default="0" description="Paystack mode">
<option value="0">Test Mode</option>
<option value="1">Live Move</option>
</field>
Expand Down
7 changes: 0 additions & 7 deletions mod_spc_paystack/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php
/**
* @package Spc Paystack Plugin
* @author Douglas Kendyson
* @copyright Copyright2017-Paystack
* @license GNUGeneralPublicLicenseversion2orlaterseeLICENSE.txt
**/

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

Expand Down

0 comments on commit 84795c9

Please sign in to comment.