Spade
Mini Shell
index.html000064400000000054151165527060006550 0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/en-GB/en-GB.plg_hikamarket_mangopay.ini000064400000004535151165527060015503
0ustar00; MangoPay
HIKAM_MANGOPAY="MangoPay"
HIKAM_MANGOPAY_TITLE="MangoPay"
HIKAM_MANGO_WALLET="Wallet"
HIKAM_MANGO_BANK="Bank account"
HIKAM_MANGO_PROFILE="Profile"
HIKAM_MANGO_DOCUMENTS="Documents"
MANGOPAY_BALANCE="Balance"
MANGOPAY_PAYOUT="Payout"
MANGOPAY_DO_PAYOUT="make a payout"
MANGOPAY_NO_PAYOUT="-"
MANGOPAY_ADD_BANKACCOUNT="Add a bank account"
MANGOPAY_NO_BANKACOUNT="You don't have registered a bank
account"
MANGOPAY_EMAIL="Email"
MANGOPAY_HEADQUARTERSADDRESS="Headquarter Address"
MANGOPAY_LEGALPERSONTYPE="Vendor type"
MANGOPAY_PERSONTYPE_BUSINESS="Business"
MANGOPAY_PERSONTYPE_ORGANIZATION="Organization"
MANGOPAY_PERSONTYPE_SOLETRADER="Sole Trader"
MANGOPAY_STATUTE="Statute"
MANGOPAY_PROOF_REGISTRATION="Proof of registration"
MANGOPAY_SHAREHOLDER_DECLARATION="Shareholder declaration"
MANGOPAY_ADD_DOCUMENT="Add document"
MANGOPAY_LEGALREPRESENTATIVE="Legal Representative"
MANGOPAY_LEGALREPRESENTATIVEFIRSTNAME="Firstname"
MANGOPAY_LEGALREPRESENTATIVELASTNAME="Lastname"
MANGOPAY_LEGALREPRESENTATIVEADDRESS="Address"
MANGOPAY_LEGALREPRESENTATIVEEMAIL="Email"
MANGOPAY_LEGALREPRESENTATIVEBIRTHDAY="Birthday"
MANGOPAY_LEGALREPRESENTATIVENATIONALITY="Nationality"
MANGOPAY_LEGALREPRESENTATIVECOUNTRYOFRESIDENCE="Country of
residence"
MANGOPAY_SAVE_BANKACCOUNT="Save bank account"
MANGOPAY_BANK_TYPE="Bank type"
MANGOPAY_BANK_TYPE_IBAN="IBAN"
MANGOPAY_BANK_TYPE_GB="GB"
MANGOPAY_BANK_TYPE_US="US"
MANGOPAY_BANK_TYPE_CA="CA"
MANGOPAY_BANK_TYPE_OTHER="Other"
MANGOPAY_BANK_OWNER_NAME="Owner name"
MANGOPAY_BANK_OWNER_ADDRESS="Owner address"
MANGOPAY_BANK_IBAN="IBAN"
MANGOPAY_BANK_BIC="BIC"
MANGOPAY_BANK_ACCOUNTNUMBER="Account number"
MANGOPAY_BANK_SORTCODE="Sort code"
MANGOPAY_BANK_ABA="ABA"
MANGOPAY_BANK_BANKNAME="Bank name"
MANGOPAY_BANK_INSTITUTIONNUMBER="Institution number"
MANGOPAY_BANK_BRANCHCODE="Branch code"
MANGOPAY_BANK_COUNTRY="Country"
MANGOPAY_DOCUMENT_TYPE="Document type"
MANGOPAY_DOCUMENT_FILE="Document file"
MANGOPAY_DOC_IDENTITY_PROOF="Proof of identity"
MANGOPAY_DOC_REGISTRATION_PROOF="Proof of registration"
MANGOPAY_DOC_ARTICLES_OF_ASSOCIATION="Articles of association"
MANGOPAY_DOC_SHAREHOLDER_DECLARATION="Shareholder declaration"
MANGOPAY_CURRENT_BALANCE="Wallet balance"
MANGOPAY_AUTHORIZED_PAYOUT="Authorized value"
MANGOPAY_PAYOUT_VALUE="Transfer"
MANGOPAY_PAYOUT_BANK="Bank
account"language/en-GB/index.html000064400000000054151165527060011223
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/en-GB/nl-BE.plg_hikamarket_mangopay.ini000064400000004443151165527060015506
0ustar00; MangoPay
HIKAM_MANGOPAY="MangoPay"
HIKAM_MANGOPAY_TITLE="MangoPay"
HIKAM_MANGO_WALLET="Portemonnee"
HIKAM_MANGO_BANK="Bankrekening"
HIKAM_MANGO_PROFILE="Profiel"
HIKAM_MANGO_DOCUMENTS="Documenten"
MANGOPAY_BALANCE="Saldo"
MANGOPAY_PAYOUT="Uitbetaling"
MANGOPAY_DO_PAYOUT="maak een uitbetaling"
MANGOPAY_NO_PAYOUT="-"
MANGOPAY_ADD_BANKACCOUNT="Voeg een bankrekening toe"
MANGOPAY_NO_BANKACOUNT="U heeft geen bankrekening geregistreerd"
MANGOPAY_EMAIL="E-mail"
MANGOPAY_HEADQUARTERSADDRESS="Hoofdkwartier Adres"
MANGOPAY_LEGALPERSONTYPE="Verkoper type"
MANGOPAY_PERSONTYPE_BUSINESS="Bedrijf"
MANGOPAY_PERSONTYPE_ORGANIZATION="Organisatie"
MANGOPAY_STATUTE="Statuut"
MANGOPAY_PROOF_REGISTRATION="Bewijs van inschrijving"
MANGOPAY_SHAREHOLDER_DECLARATION="Aandeelhouder verklaring"
MANGOPAY_ADD_DOCUMENT="Document toevoegen"
MANGOPAY_LEGALREPRESENTATIVE="Wettelijke vertegenwoordiger"
MANGOPAY_LEGALREPRESENTATIVEFIRSTNAME="Voornaam"
MANGOPAY_LEGALREPRESENTATIVELASTNAME="Achternaam"
MANGOPAY_LEGALREPRESENTATIVEADDRESS="Adres"
MANGOPAY_LEGALREPRESENTATIVEEMAIL="E-mail"
MANGOPAY_LEGALREPRESENTATIVEBIRTHDAY="Verjaardag"
MANGOPAY_LEGALREPRESENTATIVENATIONALITY="Nationaliteit"
MANGOPAY_LEGALREPRESENTATIVECOUNTRYOFRESIDENCE="Land van
Verblijf"
MANGOPAY_SAVE_BANKACCOUNT="Opslaan bankrekening"
MANGOPAY_BANK_TYPE="Bank soort"
MANGOPAY_BANK_TYPE_IBAN="IBAN"
MANGOPAY_BANK_TYPE_GB="GB"
MANGOPAY_BANK_TYPE_US="ONS"
MANGOPAY_BANK_TYPE_CA="CA"
MANGOPAY_BANK_TYPE_OTHER="Ander"
MANGOPAY_BANK_OWNER_NAME="Naam van de eigenaar"
MANGOPAY_BANK_OWNER_ADDRESS="Eigenaar adres"
MANGOPAY_BANK_IBAN="IBAN"
MANGOPAY_BANK_BIC="BIC"
MANGOPAY_BANK_ACCOUNTNUMBER="Rekeningnummer"
MANGOPAY_BANK_SORTCODE="Sorteercode"
MANGOPAY_BANK_ABA="ABA"
MANGOPAY_BANK_BANKNAME="Banknaam"
MANGOPAY_BANK_INSTITUTIONNUMBER="Instelling aantal"
MANGOPAY_BANK_BRANCHCODE="Filiaalcode"
MANGOPAY_BANK_COUNTRY="Land"
MANGOPAY_DOCUMENT_TYPE="Documenttype"
MANGOPAY_DOCUMENT_FILE="Document bestand"
MANGOPAY_DOC_IDENTITY_PROOF="Identiteitsbewijs"
MANGOPAY_DOC_REGISTRATION_PROOF="Bewijs van inschrijving"
MANGOPAY_DOC_ARTICLES_OF_ASSOCIATION="Statuten"
MANGOPAY_DOC_SHAREHOLDER_DECLARATION="Aandeelhouder verklaring"
MANGOPAY_CURRENT_BALANCE="Portemonnee balans"
MANGOPAY_AUTHORIZED_PAYOUT="Geautoriseerde waarde"
MANGOPAY_PAYOUT_VALUE="Overdracht"
MANGOPAY_PAYOUT_BANK="Bankrekening"
language/index.html000064400000000054151165527060010333
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>mangopay.php000064400000003536151165527060007107
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikamarketMangopay extends JPlugin {
public function __construct(&$subject, $config) {
parent::__construct($subject, $config);
}
public function onHikamarketPluginController($ctrl) {
if($ctrl != 'mangopay')
return;
$app = JFactory::getApplication();
$this->loadLanguage('plg_hikamarket_mangopay',
JPATH_ADMINISTRATOR);
return array(
'type' => 'hikamarket',
'name' => 'mangopay',
'prefix' => ($app->isAdmin() ? 'backend' :
'ctrl')
);
}
public function onMarketAclPluginListing(&$categories) {
if(empty($categories['root']['plugins']))
$categories['root']['plugins'] = array();
$categories['root']['plugins'][] =
'mangopay';
}
public function onVendorPanelDisplay(&$buttons, &$statistics) {
global $Itemid;
$url_itemid = '';
if(!empty($Itemid))
$url_itemid = '&Itemid=' . $Itemid;
$this->loadLanguage('plg_hikamarket_mangopay',
JPATH_ADMINISTRATOR);
$doc = JFactory::getDocument();
jimport('joomla.filesystem.file');
if(JFile::exists(HIKASHOP_MEDIA . 'css' . DS .
'mangopay.css'))
$doc->addStyleSheet(HIKASHOP_CSS .
'mangopay.css?v='.HIKAMARKET_RESSOURCE_VERSION);
else
$doc->addStyleSheet(JURI::base(true).'/plugins/hikamarket/mangopay/media/mangopay.css?v='.HIKAMARKET_RESSOURCE_VERSION);
$buttons['mangopay'] = array(
'url' =>
hikamarket::completeLink('mangopay'.$url_itemid),
'level' => 1,
'icon' => 'iconM-48-mangopay',
'name' => JText::_('HIKAM_MANGOPAY'),
'description' => '',
'display' => hikamarket::acl('plugins/mangopay')
);
}
}
mangopay.xml000064400000002354151165527060007115 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="plugin" version="2.5"
method="upgrade" group="hikamarket">
<name>HikaMarket - MangoPay integration</name>
<hikainstall ordering="1" enable="0"
report="0" />
<creationDate>20 juillet 2020</creationDate>
<version>3.1.1</version>
<author>Obsidev</author>
<authorEmail>dev@obsidev.com</authorEmail>
<authorUrl>http://www.obsidev.com</authorUrl>
<copyright>Copyright (C) 2012-2020 OBSIDEV SARL - All rights
reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html
GNU/GPL</license>
<description>This plugin allow the front-end interface for
MangoPay</description>
<files>
<filename
plugin="mangopay">mangopay.php</filename>
<filename>mangopay_ctrl.php</filename>
<filename>mangopay_class.php</filename>
<filename>mangopay_backend.php</filename>
<folder>views</folder>
<folder>media</folder>
</files>
<languages>
<language
tag="en-GB">language/en-GB/en-GB.plg_hikamarket_mangopay.ini</language>
</languages>
<params addpath="/components/com_hikamarket/params">
</params>
<config>
<fields name="params"
addfieldpath="/components/com_hikamarket/fields">
<fieldset name="basic">
</fieldset>
</fields>
</config>
</extension>
mangopay_backend.php000064400000001236151165527060010551 0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
include_once dirname(__FILE__) . DS . 'mangopay_class.php';
class mangopayMarketController extends hikamarketController {
protected $rights = array(
'display' => array(),
'add' => array(),
'edit' => array(),
'modify' => array(),
'delete' => array()
);
protected $pluginCtrl = array('hikamarket',
'mangopay');
protected $type = 'plg_mangopay';
}
mangopay_class.php000064400000027272151165527060010277 0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class hikamarketPlg_mangopayClass extends JObject {
protected static $currentMangoVendor = null;
protected static $mangopayPlugin = null;
protected static $mangopayAPI = null;
public function getMangoPlugin() {
if(empty(self::$mangopayPlugin))
self::$mangopayPlugin = hikamarket::import('hikashoppayment',
'mangopay');
return self::$mangopayPlugin;
}
public function getMangoVendor() {
if(!empty(self::$currentMangoVendor))
return self::$currentMangoVendor;
$mangopayPlugin = $this->getMangoPlugin();
$vendor = hikamarket::loadVendor(true, false);
self::$currentMangoVendor = $mangopayPlugin->getVendor($vendor);
return self::$currentMangoVendor;
}
public function getMangoAPI() {
if(!empty(self::$mangopayAPI))
return self::$mangopayAPI;
$mangopayPlugin = $this->getMangoPlugin();
self::$mangopayAPI = $mangopayPlugin->getAPI();
return self::$mangopayAPI;
}
public function debug($e, $r = false) {
$mangopayPlugin = $this->getMangoPlugin();
$mangopayPlugin->mangoDebug($e, $r);
}
public function mangoDebug($e, $r = false) { return $this->debug($e,
$r); }
public function saveForm() {
$formData = hikaInput::get()->get('mango', array(),
'array');
if(empty($formData))
return false;
$api = $this->getMangoAPI();
$mango_vendor = $this->getMangoVendor();
if(empty($mango_vendor) || empty($mango_vendor->Id))
return false;
$user = new MangoPay\UserLegal();
$user->Id = $mango_vendor->Id;
if(!empty($formData['name']))
$user->Name = substr($formData['name'], 0, 254);
if(!empty($formData['legalpersontype']) &&
in_array($formData['legalpersontype'],
array('BUSINESS', 'ORGANIZATION',
'SOLETRADER')))
$user->LegalPersonType = $formData['legalpersontype'];
if(!empty($formData['email']))
$user->Email = substr($formData['email'], 0, 254);
if(!empty($formData['headquartersaddress']))
$user->HeadquartersAddress =
substr($formData['headquartersaddress'], 0, 254);
if(!empty($formData['legalrepresentativefirstname']))
$user->LegalRepresentativeFirstName =
substr($formData['legalrepresentativefirstname'], 0, 99);
if(!empty($formData['legalrepresentativelastname']))
$user->LegalRepresentativeLastName =
substr($formData['legalrepresentativelastname'], 0, 99);
if(!empty($formData['legalrepresentativeaddress']))
$user->LegalRepresentativeAddress =
substr($formData['legalrepresentativeaddress'], 0, 254);
if(!empty($formData['legalrepresentativeemail']))
$user->LegalRepresentativeEmail =
substr($formData['legalrepresentativeemail'], 0, 254);
if(!empty($formData['legalrepresentativebirthday']))
$user->LegalRepresentativeBirthday =
hikamarket::getTime($formData['legalrepresentativebirthday']);
if(!empty($formData['legalrepresentativenationality']))
$user->LegalRepresentativeNationality =
strtoupper(substr(trim($formData['legalrepresentativenationality']),
0, 2));
if(!empty($formData['legalrepresentativecountryofresidence']))
$user->LegalRepresentativeCountryOfResidence =
strtoupper(substr(trim($formData['legalrepresentativecountryofresidence']),
0, 2));
$result = false;
try {
$result = $api->Users->Update($user);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($result) || empty($result->Id))
return false;
return $result->Id;
}
public function addBank() {
$formData = hikaInput::get()->get('mangobank', array(),
'array');
if(empty($formData))
return false;
if(empty($formData['type']) ||
!in_array($formData['type'],
array('IBAN','GB','US','CA','OTHER')))
return false;
$api = $this->getMangoAPI();
$mango_vendor = $this->getMangoVendor();
$bank = new MangoPay\BankAccount();
$bank->Type = $formData['type'];
$bank->OwnerName = $formData['ownername'];
$bank->OwnerAddress = $formData['owneraddress'];
switch($bank->Type) {
case 'IBAN':
$bank->Details = new MangoPay\BankAccountDetailsIBAN();
$bank->Details->IBAN =
$formData['iban']['iban'];
$bank->Details->BIC =
$formData['iban']['bic'];
break;
case 'GB':
$bank->Details = new MangoPay\BankAccountDetailsGB();
$bank->Details->AccountNumber =
$formData['gb']['accountnumber'];
$bank->Details->SortCode =
$formData['gb']['sortcode'];
break;
case 'US':
$bank->Details = new MangoPay\BankAccountDetailsUS();
$bank->Details->AccountNumber =
$formData['us']['accountnumber'];
$bank->Details->ABA =
$formData['us']['aba'];
break;
case 'CA':
$bank->Details = new MangoPay\BankAccountDetailsCA();
$bank->Details->BankName =
$formData['ca']['bankname'];
$bank->Details->InstitutionNumber =
$formData['ca']['institutionnumber'];
$bank->Details->BranchCode =
$formData['ca']['branchcode'];
$bank->Details->AccountNumber =
$formData['ca']['accountnumber'];
break;
case 'OTHER':
$bank->Details = new MangoPay\BankAccountDetailsOTHER();
$bank->Details->Country =
$formData['other']['country'];
$bank->Details->BIC =
$formData['other']['bic'];
$bank->Details->AccountNumber =
$formData['other']['accountnumber'];
break;
}
$result = false;
try {
$result = $api->Users->CreateBankAccount($mango_vendor->Id,
$bank);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($result) || empty($result->Id))
return false;
return $result->Id;
}
public function addDocument() {
$formData = hikaInput::get()->get('mangodoc', array(),
'array');
if(empty($formData))
return false;
$api = $this->getMangoAPI();
$mango_vendor = $this->getMangoVendor();
$document_type = strtoupper(trim($formData['type']));
if(!in_array($document_type, array('IDENTITY_PROOF',
'REGISTRATION_PROOF', 'ARTICLES_OF_ASSOCIATION',
'SHAREHOLDER_DECLARATION', 'IDENTITY_PROOF',
'ADDRESS_PROOF')))
return false;
if(empty($_FILES) || empty($_FILES['mangodoc_page']))
return false;
$file = $_FILES['mangodoc_page'];
$kyc_document = new MangoPay\KycDocument();
$kyc_document->Type = $document_type;
$createdDocument = false;
try {
$createdDocument =
$api->Users->CreateKycDocument($mango_vendor->Id, $kyc_document);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($createdDocument) || empty($createdDocument->Id))
return false;
$createdPage = false;
try {
$api->Users->CreateKycPageFromFile($mango_vendor->Id,
$createdDocument->Id, $file);
$createdPage = true;
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($createdPage))
return false;
$kyc_document = new MangoPay\KycDocument();
$kyc_document->Id = $createdDocument->Id;
$kyc_document->Status = 'VALIDATION_ASKED';
$updatedDocument = false;
try {
$updatedDocument =
$api->Users->UpdateKycDocument($mango_vendor->Id, $kyc_document);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($updatedDocument))
return false;
return true;
}
public function doPayout() {
$formData = hikaInput::get()->get('payout', array(),
'array');
if(empty($formData))
return false;
$walletId = (int)trim(@$formaData['wallet']);
if(empty($walletId))
return false;
$value = (float)hikashop_toFloat(@$formData['value']);
if($value <= 0.0)
return false;
$api = $this->getMangoAPI();
$vendor = hikamarket::loadVendor(true, false);
$mango_vendor = $this->getMangoVendor();
$mangopayPlugin = $this->getMangoPlugin();
$mango_wallets = $mangopayPlugin->getVendorWallets($vendor);
$mango_wallet = null;
foreach($mango_wallets as $mango_wallet) {
if((int)$mango_wallet->Id == $walletId) {
$mango_wallet = $mango_wallet;
break;
}
}
$duration = 31;
if(isset($mangopayPlugin->params))
$duration =
(int)$mangopayPlugin->params->get('payout_waiting_duration',
31);
if($duration <= 0)
$duration = 31;
$transactions = $this->getTransactions($mango_wallet->Id,
$duration);
$transactions_total = 0.0;
foreach($transactions as $transaction) {
if($transaction->Nature == 'REGULAR')
$transactions_total += ($transaction->CreditedFunds->Amount /
100);
if($transaction->Nature == 'REFUND')
$transactions_total -= ($transaction->CreditedFunds->Amount /
100);
}
if($transactions_total < 0)
$transactions_total = 0.0;
$maximum_authorized = ($mango_wallet->Balance->Amount / 100) -
$transactions_total;
if($maximum_authorized < 0)
$maximum_authorized = 0.0;
if($value > $maximum_authorized)
return false;
$bank_account = (int)@$formData['bank'];
if(empty($bank_account))
return false;
try {
$mango_bank_account =
$api->Users->GetBankAccount($mango_vendor->Id, $bank_account);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($mango_bank_account))
return false;
$payout = new MangoPay\PayOut();
$payout->AuthorId = $mango_vendor->Id;
$payout->DebitedWalletId = $mango_wallet->Id;
$payout->PaymentType = 'BANK_WIRE';
$payout->DebitedFunds = new MangoPay\Money();
$payout->DebitedFunds->Currency = $mango_wallet->Currency;
$payout->DebitedFunds->Amount = $value * 100;
$payout->Fees = new MangoPay\Money();
$payout->Fees->Currency = $mango_wallet->Currency;
$payout->Fees->Amount = 0;
$payout->MeanOfPaymentDetails = new
MangoPay\PayOutPaymentDetailsBankWire();
$payout->MeanOfPaymentDetails->BankAccountId =
$mango_bank_account->Id;
$payoutResult = null;
try {
$payoutResult = $api->PayOuts->Create($payout);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
if(empty($payoutResult) || empty($payoutResult->Id))
return false;
if(isset($payoutResult->Status) && $payoutResult->Status ==
'FAILED') {
switch(@$payoutResult->ResultCode) {
case '002998':
$this->errors[] = 'The bank account needs to be KYC verified.
Please contact the side owner for more details.';
break;
case '002999':
$this->errors[] = 'The account needs to be KYC verified.
Please contact the side owner for more details.';
break;
}
return false;
}
return $payoutResult;
}
public function getTransactions($wallet_id, $duration = 31) {
$api = $this->getMangoAPI();
$transactions = false;
try {
$pagination = null;
$filter = new MangoPay\FilterTransactions();
if($duration > 1)
$filter->AfterDate = time() - ($duration * 86400);
$filter->Status = 'SUCCEEDED';
$filter->Type = 'TRANSFER';
$transactions = $api->Wallets->GetTransactions($wallet_id,
$pagination, $filter);
}
catch (MangoPay\ResponseException $e) { $this->debug($e, true); }
catch (MangoPay\Exception $e) { $this->debug($e, false); }
catch (Exception $e) {}
return $transactions;
}
}
mangopay_ctrl.php000064400000012610151165527060010124 0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
include_once dirname(__FILE__) . DS . 'mangopay_class.php';
class mangopayMarketController extends hikamarketController {
protected $rights = array(
'display' => array('show'),
'add' =>
array('bank','document','payout'),
'edit' =>
array('save','addbank','adddocument','dopayout'),
'modify' => array(),
'delete' => array()
);
protected $pluginCtrl = array('hikamarket',
'mangopay');
protected $type = 'plg_mangopay';
public function __construct($config = array(), $skip = false) {
parent::__construct($config, $skip);
if(!$skip)
$this->registerDefaultTask('show');
$this->config = hikamarket::config();
}
public function show() {
if(!hikamarket::loginVendor())
return false;
if(!$this->config->get('frontend_edition',0))
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
hikaInput::get()->set('layout', 'show');
return parent::display();
}
public function bank() {
if(!hikamarket::loginVendor())
return false;
if(!$this->config->get('frontend_edition',0))
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
hikaInput::get()->set('layout', 'bank');
return parent::display();
}
public function document() {
if(!hikamarket::loginVendor())
return false;
if(!$this->config->get('frontend_edition',0))
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
hikaInput::get()->set('layout', 'document');
return parent::display();
}
public function payout() {
if(!hikamarket::loginVendor())
return false;
if(!$this->config->get('frontend_edition',0))
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
hikaInput::get()->set('layout', 'payout');
return parent::display();
}
public function addbank() {
if(!hikamarket::loginVendor())
return false;
if( !$this->config->get('frontend_edition', 0) )
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
$app = JFactory::getApplication();
JSession::checkToken() || die('Invalid Token');
$mangoClass = hikamarket::get('class.plg_mangopay');
$status = $mangoClass->addBank();
if($status) {
$app->enqueueMessage(JText::_('HIKAM_SUCC_SAVED'),
'message');
hikaInput::get()->set('cid', $status);
hikaInput::get()->set('fail', null);
return $this->show();
}
$app->enqueueMessage(JText::_('ERROR_SAVING'),
'error');
if(!empty($mangoClass->errors)) {
foreach($mangoClass->errors as $err) {
$app->enqueueMessage($err, 'error');
}
}
return $this->bank();
}
public function adddocument() {
if(!hikamarket::loginVendor())
return false;
if( !$this->config->get('frontend_edition', 0) )
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
$app = JFactory::getApplication();
JSession::checkToken() || die('Invalid Token');
$mangoClass = hikamarket::get('class.plg_mangopay');
$status = $mangoClass->adddocument();
if($status) {
$app->enqueueMessage(JText::_('HIKAM_SUCC_SAVED'),
'message');
hikaInput::get()->set('cid', $status);
hikaInput::get()->set('fail', null);
return $this->show();
}
$app->enqueueMessage(JText::_('ERROR_SAVING'),
'error');
if(!empty($mangoClass->errors)) {
foreach($mangoClass->errors as $err) {
$app->enqueueMessage($err, 'error');
}
}
return $this->document();
}
public function dopayout() {
if(!hikamarket::loginVendor())
return false;
if( !$this->config->get('frontend_edition', 0) )
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
$app = JFactory::getApplication();
JSession::checkToken() || die('Invalid Token');
$mangoClass = hikamarket::get('class.plg_mangopay');
$status = $mangoClass->doPayout();
if($status) {
$app->enqueueMessage(JText::_('MANGO_PAYOUT_DONE'),
'message');
hikaInput::get()->set('cid', $status);
hikaInput::get()->set('fail', null);
return $this->show();
}
$app->enqueueMessage(JText::_('MANGO_ERROR_PAYOU'),
'error');
if(!empty($mangoClass->errors)) {
foreach($mangoClass->errors as $err) {
$app->enqueueMessage($err, 'error');
}
}
return $this->payout();
}
public function save() {
$this->store();
return $this->show();
}
public function store() {
if(!hikamarket::loginVendor())
return false;
if( !$this->config->get('frontend_edition',0) )
return false;
if(!hikamarket::acl('plugins/mangopay'))
return hikamarket::deny('vendor',
JText::sprintf('HIKAM_ACTION_DENY', 'MangoPay'));
return $this->adminStore(true);
}
}
media/index.html000064400000000054151165527060007627
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>media/mangopay.css000064400000000116151165527060010156
0ustar00/* MangoPay CSS */
.iconM-48-mangopay
{background-image:url(./mangopay.png);}media/mangopay.png000064400000007111151165527060010154
0ustar00�PNG
IHDR00W�� pHYs��~�
�IDATh���yt�E�ǿ��~oM^��
�-�:4:c�veuilT��`�hT�eZ��vEqA�-
�p����n�B��dO^�K�U՝?~/!���s�sRU��U�nU������3C���N���a�Tef�5���b�@w�5B��,�%�x�9������q��l�w<������9kl�+(�G���KS��:�b��BD�t�_�W�_���L
XC'}�j[�Ÿ�{S�p*�w��c���_5����|!
����U��ն���-���W�)��:��5�j����ixP��sr��٥����n��.G�[�lk�Q|�]/��+=xs0<�i]E�m���e��VC'$��E]c�$�V��W�~��*�:߉Y�(���O~�z�� ?pl���%����v,�g�."�G�!�+(����u��5@��Z:|�vd<xp�
���
�+zz����nc�
2��I��ʘsƽ��n)=��IkmS
���~2<q��S_?��Sc`�U���]q��d�JY�;���ʸ:��q��[?W�����/�;��9���#�D�4�'+m��y˹��H�0�3hĶ��E��MƼH�CD����+cΰYc�)S��N�]M*E죏&��v��t$�HD^@3�[mS�\ƍ�&C���hN7�;��0ty�8��Xz�����awLPC?��
"��BE�Ɇm�~S�۩+8��
겈��66���i�
Pa
6�A�RH
k�3�쭡���nS�=�~�� j��L%�Aø�RѨ۰u�ҩ�y"����x�֦���7� 2�;H�Bj��!�~���H&b0Zq�<��~�����Z��F��`����>���i/��v)��[eS;\��?����|'&��!�m ]=<`v���~�v�_`�I
�' ۲�Ʋ�i/��$Й�6�
����J'?�l�u��){�@F�J�;xO�f�[��8�mkc��Q�m�pzIa�,6^MՑ�C"��Օ������'?���7�*�#֍���ج�����_9k�M�s����X��R�a�eZ_�&��1�65}r¢E�k?���o�LY��pGөE�
I�jS�g����?oT�D� �*CN�ؤ7
5j��Ɣ~�;�ʽay
�)�:��ṛ�܇�2l�D{E3|c�',ZtId�j'k6m���iӞfk-���`�
�6նd����_O�2Z�&}D�}�FC�>�iJ�h�`<x]�e���ٚ�P���>���d��b��6տ��)e��H
k�ml���'��$��mC��Ɛ����ߞ��idk
j-Bx�B�S��E��Jf��]�@�����
�o4T�S�&?H
�NJ�}�+�z�F=��O��7w�*��d
��צغWzCHZ{�E��~�H|v�
�"��TPʂ������OUo�0�d��%`�Z"!BjSkJ�\�0Ѵc��9�Y+j�YiG3�J��|�.&�+����6e;NH���]}2�>8�z"h��5���9ců�&�0��M$>��K"��T��J���]W:=z����o�O_��-�����Jo|,��;����Z��tAҀ��+��E�A�{H8���`|���B��@�4�m{̞�����y�7կ_�%|~a��v�z|�Ȭ�c�YkIJ�-��]W9yy�jݺ�%3f,`A���+_H4~9G����<�1$�'��:8�lUuI|嬿q���y�"#����P�W��tw�痍�;��|����VN~��Z�~�7S�>�Z����h��CR'i�0�8!ʗv�Q�1�൛B�SF��٦;"�D���Ks��������[�j�T�}�"
fi�
_�n�/�^}
�^�Q��y$�a��O��͕�nE����Ԁg�)$�H(��N��P�ߞԦV�E��IJ�D����m�����)=�6��}�b(�K蔂�ms��e�w�������8��"�UP^4sS��=H��8�939�v++Ut%�/�^&�`X�d����Y���OiS����fW��)��u�����M�/����GT��&>z1ds$Zov�td�����q��2�]YƩ��Pư���|�asq>9��A,@�c��r7��K��
"/RD,�k�̑���x{��bmj}D��V@m|wt��ok�x������҃קz�!4�Q�j'��tb�e��v�=62s�5e��!�^����":���6m�`��3ǁ[Q��;��~K�L�����
fX�d��W�rf�?h�1�
(+�?��Tپs�ۮI�!�_sK�I���H���EB�v�J�L}ݿ�02r��R�ZBR�X�
��`p�{
�Ilۜ+�.I�nErG�^���ߒ-�o��/��̕�����ો�fn�j��]7~��"B�9�,t�C�
h'�|����<22rٵ�l�$)�O��*�E
x������\�����#_�ti! !�l[�$�3���*�G�V���3�~������T�c��Dh�~6�,|ݓ#��l�1�Q�˯��ڕ$���<k���Q>�p{�9×x��HJ���E���f
�̰P2���Y�@88�ccA]��H�w��}D_G9����R�')a���y�OO\�t!)��5S��]*�`f�~'W<{rf��S:������V+��zo�z���a�'�\qas���y@9ZWW��9,��~C��vߡ
�D|Yb���S2Bǿ��#�;��+mv�s^��;ד/#Bi��J����/^)ӵR�}�����
q��=�&R��h�tI@kA_�8k�]7g�[�n$8
�gӹ�g�'�3������]�.�vկZ�@��9���N��W�\��d����Z���ř��������<Pl_���|���bR��C^b��"�N��b]|��
���z��SU��y�K=<7���y:<|���犳��uC8�c�k!�S��n>��v{1d
ӫX��q
Xk)���x}��D�+��R���@p�9+{>�l��]����b[�r��!sn���)�
�o�`w��&����m-�J��� 'ּP�\��3F�{���'��;������;�
��%"���*���?:��m��H�,�.�
�"U���79
砫RK�#L����T�CK�pS��k�#> �E�Cq��d��e�Iem]
|Æ�%��?z�l��G�BC�2[���o䊫)�s
R
��k��*gЩ�Gfͻ�����GnG����QFo�]��Z�{�ݠ
��i�:�<umd���X��h�I��32Qf_�p�D{��&@:�ICފ̞5C&�HxL�@w�7����_�P����^$�A*=m~>d}�·��@Hw�盭{^�[D��˯�@�:N����*5`pqd�CWQ(�M��Ժ���3��)�%ן�z��_p�}���x������X��_�?��U_d�WLy�T�F*xf�K����0�IEND�B`�views/index.html000064400000000054151165527060007705
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mangopaymarket/index.html000064400000000054151165527060012724
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mangopaymarket/tmpl/bank.php000064400000011656151165527060013341
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><h1><?php echo JText::_('HIKAM_MANGOPAY_TITLE');
?></h1>
<form action="<?php echo
hikamarket::completeLink('mangopay');?>"
method="post" name="hikamarket_form"
id="hikamarket_mangopay_bank_form">
<dl class="mangopay_bank_addition dl-horizontal">
<dt><?php echo JText::_('MANGOPAY_BANK_TYPE');
?></dt>
<dd><?php
$values = array(
'IBAN' => JHTML::_('select.option',
'IBAN', JText::_('MANGOPAY_BANK_TYPE_IBAN')),
'GB' => JHTML::_('select.option',
'GB', JText::_('MANGOPAY_BANK_TYPE_GB')),
'US' => JHTML::_('select.option',
'US', JText::_('MANGOPAY_BANK_TYPE_US')),
'CA' => JHTML::_('select.option',
'CA', JText::_('MANGOPAY_BANK_TYPE_CA')),
'OTHER' => JHTML::_('select.option',
'OTHER', JText::_('MANGOPAY_BANK_TYPE_OTHER')),
);
echo JHTML::_('select.genericlist', $values,
'mangobank[type]', '
onchange="window.localPage.setBankType(this);"',
'value', 'text', 'IBAN');
?></dd>
<dt><?php echo JText::_('MANGOPAY_BANK_OWNER_NAME');
?></dt>
<dd>
<input type="text" name="mangobank[ownername]"
value=""/>
</dd>
<dt><?php echo
JText::_('MANGOPAY_BANK_OWNER_ADDRESS'); ?></dt>
<dd>
<input type="text" name="mangobank[owneraddress]"
value=""/>
</dd>
</dl>
<dl id="mangopay_bank_iban"
class="mangopay_bank_addition dl-horizontal">
<dt><?php echo JText::_('MANGOPAY_BANK_IBAN');
?></dt>
<dd>
<input type="text" name="mangobank[iban][iban]"
value=""/>
</dd>
<dt><?php echo JText::_('MANGOPAY_BANK_BIC');
?></dt>
<dd>
<input type="text" name="mangobank[iban][bic]"
value=""/>
</dd>
</dl>
<dl id="mangopay_bank_gb" class="mangopay_bank_addition
dl-horizontal" style="display:none;">
<dt><?php echo
JText::_('MANGOPAY_BANK_ACCOUNTNUMBER'); ?></dt>
<dd>
<input type="text"
name="mangobank[gb][accountnumber]" value=""/>
</dd>
<dt><?php echo JText::_('MANGOPAY_BANK_SORTCODE');
?></dt>
<dd>
<input type="text" name="mangobank[gb][sortcode]"
value=""/>
</dd>
</dl>
<dl id="mangopay_bank_us" class="mangopay_bank_addition
dl-horizontal" style="display:none;">
<dt><?php echo
JText::_('MANGOPAY_BANK_ACCOUNTNUMBER'); ?></dt>
<dd>
<input type="text"
name="mangobank[us][accountnumber]" value=""/>
</dd>
<dt><?php echo JText::_('MANGOPAY_BANK_ABA');
?></dt>
<dd>
<input type="text" name="mangobank[us][aba]"
value=""/>
</dd>
</dl>
<dl id="mangopay_bank_ca" class="mangopay_bank_addition
dl-horizontal" style="display:none;">
<dt><?php echo JText::_('MANGOPAY_BANK_BANKNAME');
?></dt>
<dd>
<input type="text" name="mangobank[ca][bankname]"
value=""/>
</dd>
<dt><?php echo
JText::_('MANGOPAY_BANK_INSTITUTIONNUMBER'); ?></dt>
<dd>
<input type="text"
name="mangobank[ca][institutionnumber]" value=""/>
</dd>
<dt><?php echo JText::_('MANGOPAY_BANK_BRANCHCODE');
?></dt>
<dd>
<input type="text"
name="mangobank[ca][branchcode]" value=""/>
</dd>
<dt><?php echo
JText::_('MANGOPAY_BANK_ACCOUNTNUMBER'); ?></dt>
<dd>
<input type="text"
name="mangobank[ca][accountnumber]" value=""/>
</dd>
</dl>
<dl id="mangopay_bank_other"
class="mangopay_bank_addition dl-horizontal"
style="display:none;">
<dt><?php echo JText::_('MANGOPAY_BANK_COUNTRY');
?></dt>
<dd>
<input type="text"
name="mangobank[other][country]" value=""/>
</dd>
<dt><?php echo JText::_('MANGOPAY_BANK_BIC');
?></dt>
<dd>
<input type="text" name="mangobank[other][bic]"
value=""/>
</dd>
<dt><?php echo
JText::_('MANGOPAY_BANK_ACCOUNTNUMBER'); ?></dt>
<dd>
<input type="text"
name="mangobank[other][accountnumber]" value=""/>
</dd>
</dl>
<div>
<input class="btn btn-primary" value="<?php echo
JText::_('MANGOPAY_SAVE_BANKACCOUNT'); ?>"
type="submit" onclick="return
window.hikamarket.submitform('addbank','hikamarket_mangopay_bank_form');"/>
<div style="float:right">
<a class="btn btn-info" href="<?php echo
hikamarket::completeLink('mangopay'); ?>"><?php
echo JText::_('HIKA_CANCEL'); ?></a>
</div>
</div>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
<input type="hidden" name="task"
value="bank"/>
<input type="hidden" name="ctrl"
value="mangopay"/>
<?php echo JHTML::_('form.token'); ?>
</form>
<script type="text/javascript">
if(!window.localPage)
window.localPage = {};
window.localPage.bankType = 'iban';
window.localPage.setBankType = function(el) {
var d = document, e = null;
e = d.getElementById('mangopay_bank_' +
window.localPage.bankType);
if(e) e.style.display = 'none';
window.localPage.bankType = el.value.toLowerCase();
e = d.getElementById('mangopay_bank_' +
window.localPage.bankType);
if(e) e.style.display = '';
};
</script>
views/mangopaymarket/tmpl/document.php000064400000004062151165527060014235
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><h1><?php echo JText::_('HIKAM_MANGOPAY_TITLE');
?></h1>
<form action="<?php echo
hikamarket::completeLink('mangopay');?>"
method="post" name="hikamarket_form"
id="hikamarket_mangopay_document_form"
enctype="multipart/form-data">
<dl class="mangopay_documents dl-horizontal">
<dt><?php
echo JText::_('MANGOPAY_DOCUMENT_TYPE');
?></dt>
<dd><?php
$values = array(
'IDENTITY_PROOF' => JHTML::_('select.option',
'IDENTITY_PROOF',
JText::_('MANGOPAY_DOC_IDENTITY_PROOF')),
'REGISTRATION_PROOF' =>
JHTML::_('select.option', 'REGISTRATION_PROOF',
JText::_('MANGOPAY_DOC_REGISTRATION_PROOF')),
'ARTICLES_OF_ASSOCIATION' =>
JHTML::_('select.option', 'ARTICLES_OF_ASSOCIATION',
JText::_('MANGOPAY_DOC_ARTICLES_OF_ASSOCIATION')),
'SHAREHOLDER_DECLARATION' =>
JHTML::_('select.option', 'SHAREHOLDER_DECLARATION',
JText::_('MANGOPAY_DOC_SHAREHOLDER_DECLARATION')),
);
echo JHTML::_('select.genericlist', $values,
'mangodoc[type]', '', 'value',
'text', '');
?></dd>
<dt><?php
echo JText::_('MANGOPAY_DOCUMENT_FILE');
?></dt>
<dd>
<input type="file" name="mangodoc_page"/>
</dd>
</dl>
<div>
<input class="btn btn-primary" value="<?php echo
JText::_('MANGOPAY_ADD_DOCUMENT'); ?>"
type="submit" onclick="return
window.hikamarket.submitform('adddocument','hikamarket_mangopay_document_form');"/>
<div style="float:right">
<a class="btn btn-info" href="<?php echo
hikamarket::completeLink('mangopay'); ?>"><?php
echo JText::_('HIKA_CANCEL'); ?></a>
</div>
</div>
<div style="clear:both"></div>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
<input type="hidden" name="task"
value="bank"/>
<input type="hidden" name="ctrl"
value="mangopay"/>
<?php echo JHTML::_('form.token'); ?>
</form>
views/mangopaymarket/tmpl/index.html000064400000000054151165527060013700
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mangopaymarket/tmpl/payout.php000064400000005077151165527060013747
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><h1><?php echo JText::_('HIKAM_MANGOPAY_TITLE');
?></h1>
<form action="<?php echo
hikamarket::completeLink('mangopay');?>"
method="post" name="hikamarket_form"
id="hikamarket_mangopay_payout_form">
<dl class="mangopay_payout dl-horizontal">
<dt><?php echo JText::_('MANGOPAY_CURRENT_BALANCE');
?></dt>
<dd><?php echo
$this->currencyClass->format($this->mango_wallet->Balance->Amount
/ 100, $this->currency_id); ?></dd>
<dt><?php echo JText::_('MANGOPAY_AUTHORIZED_PAYOUT');
?></dt>
<dd><?php echo
$this->currencyClass->format($this->maximum_authorized,
$this->currency_id); ?></dd>
</dl>
<dl class="mangopay_payout dl-horizontal">
<dt><?php echo JText::_('MANGOPAY_PAYOUT_VALUE');
?></dt>
<dd>
<input type="text" value="<?php echo
number_format($this->maximum_authorized, 2, '.',
''); ?>" placeholder="<?php echo
number_format($this->maximum_authorized, 2, '.',
''); ?>" name="payout[value]"/>
<?php echo $this->mango_wallet->Balance->Currency;?>
</dd>
<dt><?php echo JText::_('MANGOPAY_PAYOUT_BANK');
?></dt>
<dd><?php
if(empty($this->mango_bank_accounts)) {
echo '<em>' .
JText::_('MANGOPAY_NO_BANK_ACCOUNT') . '</em>';
} else {
$bank_accounts = array();
foreach($this->mango_bank_accounts as $bank_account) {
$bank_accounts[] = JHTML::_('select.option',
$bank_account->Id, $bank_account->OwnerName . ' ' .
$bank_account->OwnerAddress . ' (' . $bank_account->Type .
')');
}
echo JHTML::_('select.genericlist', $bank_accounts,
'payout[bank]', ' style="width:100%"',
'value', 'text', '');
}
?></dd>
</dl>
<div>
<input class="btn btn-primary" value="<?php echo
JText::_('MANGOPAY_PAYOUT'); ?>" type="submit"
onclick="return
window.hikamarket.submitform('dopayout','hikamarket_mangopay_payout_form');"/>
<div style="float:right">
<a class="btn btn-info" href="<?php echo
hikamarket::completeLink('mangopay'); ?>"><?php
echo JText::_('HIKA_CANCEL'); ?></a>
</div>
</div>
<div style="clear:both"></div>
<input type="hidden" name="payout[wallet]"
value="<?php echo $this->walletId; ?>"/>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
<input type="hidden" name="task"
value="payout"/>
<input type="hidden" name="ctrl"
value="mangopay"/>
<?php echo JHTML::_('form.token'); ?>
</form>
views/mangopaymarket/tmpl/show.php000064400000022460151165527060013401
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><h1><?php echo JText::_('HIKAM_MANGOPAY_TITLE');
?></h1>
<form action="<?php echo
hikamarket::completeLink('mangopay');?>"
method="post" name="hikamarket_form"
id="hikamarket_mangopay_form">
<ul class="hikam_tabs"
rel="tabs:hikamarket_mangopay_tab_">
<li class="active"><a href="#wallet"
rel="tab:1" onclick="return
window.hikamarket.switchTab(this);"><?php echo
JText::_('HIKAM_MANGO_WALLET'); ?></a></li>
<li><a href="#bank" rel="tab:2"
onclick="return window.hikamarket.switchTab(this);"><?php
echo JText::_('HIKAM_MANGO_BANK'); ?></a></li>
<li><a href="#profile" rel="tab:3"
onclick="return window.hikamarket.switchTab(this);"><?php
echo JText::_('HIKAM_MANGO_PROFILE'); ?></a></li>
<li><a href="#document" rel="tab:4"
onclick="return window.hikamarket.switchTab(this);"><?php
echo JText::_('HIKAM_MANGO_DOCUMENTS');
?></a></li>
</ul>
<div style="clear:both"></div>
<div id="hikamarket_mangopay_tab_1">
<?php
if(count($this->mango_wallets) == 1) {
$wallet = reset($this->mango_wallets);
?>
<dl class="mangopay_wallet_details dl-horizontal">
<dt><?php echo JText::_('CURRENCY'); ?></dt>
<dd><?php echo $wallet->Currency; ?></dd>
<dt><?php echo JText::_('MANGOPAY_BALANCE');
?></dt>
<dd><?php
$currency_id =
$this->convertCurrency($wallet->Balance->Currency);
$amount = (float)hikamarket::toFloat($wallet->Balance->Amount) /
100;
echo $this->currencyClass->format($amount, $currency_id);
?></dd>
<dt><?php echo JText::_('MANGOPAY_PAYOUT');
?></dt>
<dd><?php
if($amount > 0)
echo '<a
href="'.hikamarket::completeLink('mangopay&task=payout&wallet='.(int)$wallet->Id).'">'.JText::_('MANGOPAY_DO_PAYOUT').'</a>';
else
echo
'<em>'.JText::_('MANGOPAY_NO_PAYOUT').'</em>';
?></dd>
</dl>
<?php
} else {
?>
<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped
table-hover':'hikam_table'; ?>"
style="width:100%">
<thead>
<tr>
<th><?php echo JText::_('CURRENCY');
?></th>
<th><?php echo JText::_('MANGOPAY_BALANCE');
?></th>
<th><?php echo JText::_('MANGOPAY_PAYOUT');
?></th>
</tr>
</thead>
<tbody>
<?php
foreach($this->mango_wallets as $wallet) {
?>
<tr>
<td><?php echo $wallet->Currency; ?></td>
<td><?php
$currency_id =
$this->convertCurrency($wallet->Balance->Currency);
$amount = (float)hikamarket::toFloat($wallet->Balance->Amount) /
100;
echo $this->currencyClass->format($amount, $currency_id);
?></td>
<td><?php
if($amount > 0)
echo '<a class="btn btn-success"
href="'.hikamarket::completeLink('mangopay&task=payout&wallet='.(int)$wallet->Id).'">'.JText::_('MANGOPAY_DO_PAYOUT').'</a>';
else
echo
'<em>'.JText::_('MANGOPAY_NO_PAYOUT').'</em>';
?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
?>
</div>
<div id="hikamarket_mangopay_tab_2"
style="display:none;">
<?php
if(!empty($this->mango_bank_accounts)) {
?>
<table class="hikam_listing <?php echo
(HIKASHOP_RESPONSIVE)?'table table-striped
table-bordered':'hikam_table'; ?>"
style="width:100%">
<thead>
<tr>
<th><?php echo JText::_('MANGOPAY_BANK_TYPE');
?></th>
<th><?php echo JText::_('MANGOPAY_BANK_OWNER_NAME');
?></th>
<th><?php echo
JText::_('MANGOPAY_BANK_OWNER_ADDRESS'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach($this->mango_bank_accounts as $bank) {
?>
<tr>
<td><?php echo $this->escape($bank->Type);
?></td>
<td><?php echo $this->escape($bank->OwnerName);
?></td>
<td><?php echo $this->escape($bank->OwnerAddress);
?></td>
</tr>
<tr><td colspan="3">
<dl class="mangopay_bank_details
dl-horizontal"><?php
foreach($bank->Details as $k => $v) {
echo
'<dt>'.JText::_('MANGOPAY_BANK_'.$k).'</dt>'.
'<dd>'.$this->escape($v).'</dd>';
}
?></dl>
</td></tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
echo
'<p><em>'.JText::_('MANGOPAY_NO_BANKACOUNT').'</em></p>';
}
?>
<a class="btn btn-info" href="<?php echo
hikamarket::completeLink('mangopay&task=bank');
?>"><?php echo
JText::_('MANGOPAY_ADD_BANKACCOUNT'); ?></a>
</div>
<div id="hikamarket_mangopay_tab_3"
style="display:none;">
<dl class="mangopay_profile_main dl-horizontal">
<dt><?php
echo JText::_('HIKA_NAME');
?></dt>
<dd><input type="text" name="mango[name]"
value="<?php echo
$this->escape($this->mango_vendor->Name);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_EMAIL');
?></dt>
<dd><input type="text" name="mango[email]"
value="<?php echo
$this->escape($this->mango_vendor->Email);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALPERSONTYPE');
?></dt>
<dd><?php
$values = array(
'BUSINESS' => JHTML::_('select.option',
'BUSINESS', JText::_('MANGOPAY_PERSONTYPE_BUSINESS')),
'ORGANIZATION' => JHTML::_('select.option',
'ORGANIZATION',
JText::_('MANGOPAY_PERSONTYPE_ORGANIZATION')),
'SOLETRADER' => JHTML::_('select.option',
'SOLETRADER',
JText::_('MANGOPAY_PERSONTYPE_SOLETRADER')),
);
echo JHTML::_('select.genericlist', $values,
'mango[legalpersontype]', '', 'value',
'text', $this->mango_vendor->LegalPersonType);
?></dd>
<dt><?php
echo JText::_('MANGOPAY_HEADQUARTERSADDRESS');
?></dt>
<dd><input type="text"
name="mango[headquartersaddress]" value="<?php echo
$this->escape($this->mango_vendor->HeadquartersAddress);
?>"/></dd>
</dl>
<h3><?php echo
JText::_('MANGOPAY_LEGALREPRESENTATIVE'); ?></h3>
<dl class="mangopay_profile_legal dl-horizontal">
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVEFIRSTNAME');
?></dt>
<dd><input type="text"
name="mango[legalrepresentativefirstname]" value="<?php
echo
$this->escape($this->mango_vendor->LegalRepresentativeFirstName);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVELASTNAME');
?></dt>
<dd><input type="text"
name="mango[legalrepresentativelastname]" value="<?php
echo
$this->escape($this->mango_vendor->LegalRepresentativeLastName);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVEADDRESS');
?></dt>
<dd><input type="text"
name="mango[legalrepresentativeaddress]" value="<?php
echo
$this->escape($this->mango_vendor->LegalRepresentativeAddress);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVEEMAIL');
?></dt>
<dd><input type="text"
name="mango[legalrepresentativeemail]" value="<?php echo
$this->escape($this->mango_vendor->LegalRepresentativeEmail);
?>"/></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVEBIRTHDAY');
?></dt>
<dd><?php
$birthday =
(int)$this->mango_vendor->LegalRepresentativeBirthday;
if(empty($birthday))
$birthday = time();
echo JHTML::_('calendar',
hikamarket::getDate($birthday,'%Y-%m-%d'),
'mango[legalrepresentativebirthday]','mango_legalrepresentativebirthday','%Y-%m-%d',array('size'
=> '20'));
?></dd>
<dt><?php
echo JText::_('MANGOPAY_LEGALREPRESENTATIVENATIONALITY');
?></dt>
<dd><?php
$countries = $this->getCountryList();
echo JHTML::_('select.genericlist', $countries,
'mango[legalrepresentativenationality]', '',
'value', 'text',
$this->mango_vendor->LegalRepresentativeNationality);
?></dd>
<dt><?php
echo
JText::_('MANGOPAY_LEGALREPRESENTATIVECOUNTRYOFRESIDENCE');
?></dt>
<dd><?php
echo JHTML::_('select.genericlist', $countries,
'mango[legalrepresentativecountryofresidence]', '',
'value', 'text',
$this->mango_vendor->LegalRepresentativeCountryOfResidence);
?></dd>
</dl>
<input class="btn btn-primary" value="<?php echo
JText::_('HIKA_SAVE'); ?>" type="submit"
onclick="return
window.hikamarket.submitform('save','hikamarket_mangopay_form');"/>
</div>
<div id="hikamarket_mangopay_tab_4"
style="display:none;">
<dl class="mangopay_profile_documents dl-horizontal">
<dt><?php
echo JText::_('MANGOPAY_STATUTE');
?></dt>
<dd><?php
if($this->mango_vendor->Statute == null) {
echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
} else {
echo $this->escape($this->mango_vendor->Statute);
}
?></dd>
<dt><?php
echo JText::_('MANGOPAY_PROOF_REGISTRATION');
?></dt>
<dd><?php
if($this->mango_vendor->ProofOfRegistration == null) {
echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
} else {
echo $this->escape($this->mango_vendor->ProofOfRegistration);
}
?></dd>
<?php
if($this->mango_vendor->LegalPersonType == 'BUSINESS') {
?>
<dt><?php
echo JText::_('MANGOPAY_SHAREHOLDER_DECLARATION');
?></dt>
<dd><?php
if($this->mango_vendor->ShareholderDeclaration == null) {
echo '<em>' . JText::_('HIKA_NONE') .
'</em>';
} else {
echo
$this->escape($this->mango_vendor->ShareholderDeclaration);
}
?></dd>
<?php
}
?>
</dl>
<a class="btn btn-info" href="<?php echo
hikamarket::completeLink('mangopay&task=document');
?>"><?php echo JText::_('MANGOPAY_ADD_DOCUMENT');
?></a>
</div>
<input type="hidden" name="option"
value="<?php echo HIKAMARKET_COMPONENT; ?>"/>
<input type="hidden" name="task"
value="show"/>
<input type="hidden" name="ctrl"
value="mangopay"/>
<?php echo JHTML::_('form.token'); ?>
</form>
views/mangopaymarket/view.html.php000064400000013655151165527060013370
0ustar00<?php
/**
* @package HikaMarket for Joomla!
* @version 3.1.1
* @author Obsidev S.A.R.L.
* @copyright (C) 2011-2020 OBSIDEV. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class mangopaymarketViewmangopaymarket extends HikamarketView {
public function display($tpl = null, $params = array()) {
$this->params =& $params;
$fct = $this->getLayout();
if(method_exists($this, $fct)) {
if($this->$fct() === false)
return;
}
parent::display($tpl);
}
protected function loadCSS() {
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::base(true).'/plugins/hikamarket/mangopay/media/mangopay.css?v='.HIKAMARKET_RESSOURCE_VERSION);
}
public function show() {
$this->loadCSS();
$config = hikamarket::config();
$shopConfig = hikamarket::config(false);
$this->vendor = hikamarket::loadVendor(true);
if(is_string($this->vendor->vendor_params) &&
!empty($this->vendor->vendor_params))
$this->vendor->vendor_params =
hikamarket::unserialize($this->vendor->vendor_params);
$this->currencyClass =
hikamarket::get('shop.class.currency');
$this->mangoClass = hikamarket::get('class.plg_mangopay');
$this->mangopayPlugin = $this->mangoClass->getMangoPlugin();
$this->api = $this->mangoClass->getMangoAPI();
$this->mango_vendor = null;
$this->mango_wallets = null;
$this->mango_bank_accounts = null;
$this->mango_vendor =
$this->mangopayPlugin->getVendor($this->vendor);
if(!empty($this->mango_vendor->Id)) {
$this->mango_wallets =
$this->mangopayPlugin->getVendorWallets($this->vendor);
if(empty($this->mango_wallets)) {
$wallet =
$this->mangopayPlugin->getVendorWallet($this->vendor, null,
true);
$this->mango_wallets[ strtolower($wallet->Currency) ] = $wallet;
}
try {
$this->mango_bank_accounts =
$this->api->Users->GetBankAccounts($this->mango_vendor->Id);
}
catch (MangoPay\ResponseException $e) {
$this->mangoClass->mangoDebug($e, true); }
catch (MangoPay\Exception $e) { $this->mangoClass->mangoDebug($e,
false); }
catch (Exception $e) {}
}
$this->toolbar = array(
array(
'icon' => 'back',
'name' => JText::_('HIKA_BACK'),
'url' => hikamarket::completeLink('vendor')
)
);
}
public function payout() {
$this->loadCSS();
$config = hikamarket::config();
$shopConfig = hikamarket::config(false);
$app = JFactory::getApplication();
$this->vendor = hikamarket::loadVendor(true);
if(is_string($this->vendor->vendor_params) &&
!empty($this->vendor->vendor_params))
$this->vendor->vendor_params =
hikamarket::unserialize($this->vendor->vendor_params);
$walletId = hikaInput::get()->getInt('wallet', 0);
if(empty($walletId)) {
$app->enqueueMessage(JText::_('MANGO_INVALID_REQUEST'));
$app->redirect( hikamarket::completeLink('mangopay', false,
true, false) );
}
$this->currencyClass =
hikamarket::get('shop.class.currency');
$this->mangoClass = hikamarket::get('class.plg_mangopay');
$this->mangopayPlugin = $this->mangoClass->getMangoPlugin();
$this->mango_vendor =
$this->mangopayPlugin->getVendor($this->vendor);
if(empty($this->mango_vendor->Id)) {
$app->enqueueMessage(JText::_('MANGO_INVALID_REQUEST'));
$app->redirect( hikamarket::completeLink('mangopay', false,
true, false) );
}
$this->api = $this->mangoClass->getMangoAPI();
$this->mango_wallets = null;
$this->mango_bank_accounts = null;
$mango_wallets =
$this->mangopayPlugin->getVendorWallets($this->vendor);
$this->mango_wallet = null;
foreach($mango_wallets as $mango_wallet) {
if((int)$mango_wallet->Id == $walletId) {
$this->mango_wallet = $mango_wallet;
break;
}
}
if(empty($this->mango_wallet)) {
$app->enqueueMessage(JText::_('MANGO_INVALID_WALLET'));
$app->redirect( hikamarket::completeLink('mangopay', false,
true, false) );
}
$this->assignRef('walletId', $walletId);
$duration = 31;
if(isset($this->mangopayPlugin->params))
$duration =
(int)$this->mangopayPlugin->params->get('payout_waiting_duration',
31);
if($duration <= 0)
$duration = 31;
$this->currency_id =
$this->convertCurrency($this->mango_wallet->Balance->Currency);
$this->transactions =
$this->mangoClass->getTransactions($this->mango_wallet->Id,
$duration);
$this->transactions_total = 0.0;
foreach($this->transactions as $transaction) {
if($transaction->Nature == 'REGULAR')
$this->transactions_total +=
($transaction->CreditedFunds->Amount / 100);
if($transaction->Nature == 'REFUND')
$this->transactions_total -=
($transaction->CreditedFunds->Amount / 100);
}
if($this->transactions_total < 0)
$this->transactions_total = 0.0;
$this->maximum_authorized =
($this->mango_wallet->Balance->Amount / 100) -
$this->transactions_total;
if($this->maximum_authorized < 0)
$this->maximum_authorized = 0.0;
try {
$this->mango_bank_accounts =
$this->api->Users->GetBankAccounts($this->mango_vendor->Id);
}
catch (MangoPay\ResponseException $e) {
$this->mangoClass->mangoDebug($e, true); }
catch (MangoPay\Exception $e) { $this->mangoClass->mangoDebug($e,
false); }
catch (Exception $e) {}
}
public function document() {
}
public function getCountryList() {
if(empty($this->mangopayPlugin))
$this->mangopayPlugin = $this->mangoClass->getMangoPlugin();
$countries = $this->mangopayPlugin->getCountryList();
$ret = array();
foreach($countries as $country) {
$ret[] = JHTML::_('select.option', $country, $country);
}
return $ret;
}
protected function convertCurrency($currency_code) {
$db = JFactory::getDBO();
$query = 'SELECT currency_id FROM ' .
hikamarket::table('shop.currency') . ' WHERE currency_code =
' . $db->Quote(strtoupper(trim($currency_code)));
$db->setQuery($query);
$ret = (int)$db->loadResult();
return $ret;
}
}