Commit d12a9a27 authored by Vipo's avatar Vipo 💬

Donation system

parent 88fcd086

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -22,7 +22,6 @@ user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
/vendor/
# IDE Files
#-------------------------
......
......@@ -58,6 +58,7 @@ $lang['button_create'] = 'Create';
$lang['button_save'] = 'Save';
$lang['button_close'] = 'Close';
$lang['button_reply'] = 'Reply';
$lang['button_donate'] = 'Donate';
/*Footer Lang*/
$lang['footer_rights'] = 'ALL RIGHTS RESERVED.';
......
......@@ -379,8 +379,8 @@ class Admin extends MX_Controller {
{
ini_set('max_execution_time', 186400);
$startitem = 1;
$maxitemid = 50000;
$startitem = 99999;
$maxitemid = 150000;
for ($i = $startitem; $i < $maxitemid; $i++) {
{
......
......@@ -2,13 +2,27 @@
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Paymentwall (Donations)
|--------------------------------------------------------------------------
|
| Complete correctly the fields
| https://paymentwall.com
*/
$config['paymentwall_project_key'] = "00000000000000000000000";
$config['paymentwall_secret_key'] = "00000000000000000000000";
$config['paymentwall_widget_code'] = "p1_1"; // p10_1 for paymentwall_multi
\ No newline at end of file
Currency to use available with PayPal
CHeck the options:
https://developer.paypal.com/docs/classic/api/currency_codes/
*/
$config['currencyType'] = 'USD';
/*
Mode PayPal
* sandbox
* live
*/
$config['ppMode'] = 'sandbox';
/*
Client id
https://developer.paypal.com/developer/applications
*/
$config['userID'] = 'AeEKmkcWH_NGf5Uxkoos5ESv3fffSBnlC1b-BJTAUF2vP02Klwa_IXXzUKqtP1tGZHF_gCRPjNjyBo7V';
/*
secret password
https://developer.paypal.com/developer/applications
*/
$config['secretPass'] = 'EEaly2bYOVTbv1hsMPesPESGF-fFyFm_HMWij_0mFiiRAEibc-SdSeqCMPFlF0ziuzsZXNcBXxecsn2V';
\ No newline at end of file
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Donate extends MX_Controller {
require './vendor/autoload.php';
public function __construct()
use \PayPal\Api\PaymentExecution;
class Donate extends MX_Controller
{
function __construct()
{
//Call the constructor of MX_Controller
parent::__construct();
if(!ini_get('date.timezone'))
date_default_timezone_set($this->config->item('timezone'));
if(!$this->m_data->isLogged())
if(!$this->m_permissions->getMaintenance())
redirect(base_url(),'refresh');
......@@ -22,13 +28,23 @@ class Donate extends MX_Controller {
$this->load->config('donate');
$this->load->model('donate_model');
}
public function index()
{
$data['fxtitle'] = $this->lang->line('nav_donate');
$this->load->view('header', $data);
$this->load->view('index');
$this->load->view('footer');
}
}
public function complete($id)
{
$this->donate_model->completeTransaction($id, $_GET['paymentId']);
}
public function cancelled()
{
redirect(base_url('donate'),'refresh');
}
}
\ No newline at end of file
<?php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Donate_model extends CI_Model {
require './vendor/autoload.php';
public function __construct()
//api function
use \PayPal\Rest\ApiContext;
use \PayPal\Auth\OAuthTokenCredential;
use \PayPal\Api\PaymentExecution;
//adds
use \PayPal\Api\Payer;
use \PayPal\Api\Amount;
use \PayPal\Api\Payment;
use \PayPal\Api\Details;
use \PayPal\Api\Transaction;
use \PayPal\Api\RedirectUrls;
use \PayPal\Exception\PPConnectionException;
class Donate_model extends CI_Model
{
public function getApi()
{
$api = new ApiContext(
new OAuthTokenCredential(
$this->config->item('userID'),
$this->config->item('secretPass')
)
);
$api->setConfig([
'mode' => $this->config->item('ppMode'),
'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => false,
'log.FileName' => 'logsPaypal',
'log.LogLevel' => 'FINE',
'validation.level' => 'log'
]);
return $api;
}
public function getSpecifyDonate($id)
{
return $this->db->select('*')
->where('id', $id)
->get('fx_donate');
}
public function getDonate($id)
{
$payer = new Payer();
$details = new Details();
$amount = new Amount();
$transaction = new Transaction();
$payment = new Payment();
$redirectUrls = new RedirectUrls();
$setTax = $this->getSpecifyDonate($id)->row('price');
$setPrice = $this->getSpecifyDonate($id)->row('tax');
$setTotal = ($setTax+$setPrice);
//Payer
$payer->setPaymentMethod('paypal');
//details
$details->setShipping('0.00')
->setTax($setTax)
->setSubtotal($setPrice);
$amount->setCurrency("USD")
->setTotal($setTotal)
->setDetails($details);
//transaction
$transaction->setAmount($amount);
//payment
$payment->setIntent('sale')
->setPayer($payer)