Commit 597f3ed6 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

adding mango pay interfaces

parent 6fe53076
......@@ -16,13 +16,13 @@ class CommunecterController extends Controller
public $projectName = "";
public $projectImage = "/images/CTK.png";
public $projectImageL = "/images/logo.png";
public $footerImages = array(
/*public $footerImages = array(
array("img"=>"/images/logoORD.PNG","url"=>"http://openrd.io"),
array("img"=>"/images/logo_region_reunion.png","url"=>"http://www.regionreunion.com"),
array("img"=>"/images/technopole.jpg","url"=>"http://technopole-reunion.com"),
array("img"=>"/images/Logo_Licence_Ouverte_noir_avec_texte.gif","url"=>"https://data.gouv.fr"),
array("img"=>'/images/blog-github.png',"url"=>"https://github.com/orgs/pixelhumain/dashboard"),
array("img"=>'/images/opensource.gif',"url"=>"http://opensource.org/"));
array("img"=>'/images/opensource.gif',"url"=>"http://opensource.org/"));*/
const theme = "ph-dori";
public $person = null;
public $themeStyle = "theme-style11";//3,4,5,7,9
......@@ -545,7 +545,8 @@ class CommunecterController extends Controller
if( Yii::app()->controller->id == "adminpublic" && ( !Yii::app()->session[ "userIsAdmin" ] && !Yii::app()->session[ "userIsAdminPublic" ] ) )
throw new CHttpException(403,Yii::t('error','Unauthorized Access.'));
$page = $this->pages[Yii::app()->controller->id][Yii::app()->controller->action->id];
if( Yii::app()->controller->id != "test")
$page = $this->pages[Yii::app()->controller->id][Yii::app()->controller->action->id];
$pagesWithoutLogin = array(
//Login Page
"person/login",
......@@ -597,6 +598,9 @@ class CommunecterController extends Controller
$this->notifications = ActivityStream::getNotifications( array( "notify.id" => Yii::app()->session["userId"] ) );
CornerDev::addWorkLog("communecter",Yii::app()->session["userId"],Yii::app()->controller->id,Yii::app()->controller->action->id);
}
//load any DB config Params
Application::loadDBAppConfig();
}
protected function beforeAction($action){
......
......@@ -2,6 +2,7 @@
class TestController extends CommunecterController {
protected function beforeAction($action) {
parent::initPage();
return parent::beforeAction($action);
}
public function actionIndex() {
......@@ -14,40 +15,87 @@ class TestController extends CommunecterController {
$api = new MangoPay\MangoPayApi();
// configuration
$api->Config->ClientId = 'communecter';
$api->Config->ClientPassword = 'JUN1QGgxxxASJBQbe1QNLX4zGX0Sjd3EEdeVVejwVTNmBLMbdh';
$api->Config->TemporaryFolder = '../../tmp';
$api->Config->ClientId = Yii::app()->params["mangoPay"]["ClientId"];
$api->Config->ClientPassword = Yii::app()->params["mangoPay"]["ClientPassword"];
$api->Config->TemporaryFolder = Yii::app()->params["mangoPay"]["TemporaryFolder"];
/*define('MangoPayDemo_ClientId', Yii::app()->params["mangoPay"]["ClientId"]);
define('MangoPayDemo_ClientPassword', Yii::app()->params["mangoPay"]["ClientPassword"]);
define('TemporaryFolder',Yii::app()->params["mangoPay"]["TemporaryFolder"]);
*/
// call some API methods...
echo "inside Mango ";
try {
$User = new MangoPay\UserNatural();
$User->Email = "test_natural@testmangopay.com";
$User->FirstName = "Bob";
$User->LastName = "Briant";
$User->Birthday = 121271;
$User->Nationality = "FR";
$User->CountryOfResidence = "ZA";
$result = $api->Users->Create($User);
var_dump($result);
$users = $api->Users->GetAll();
foreach ($user as $key => $value) {
echo $user->FirstName."<br/>";
/*$User = new MangoPay\UserNatural();
/*try {
$john = $api->Users->Get("xx");
if(!@$john){
$User = new MangoPay\UserNatural();
$User->Email = "test_natural@testmangopay.com";
$User->FirstName = "Bob";
$User->LastName = "Briant";
$User->FirstName = "xxx";
$User->LastName = "yyyy";
$User->Birthday = 121271;
$User->Nationality = "FR";
$User->CountryOfResidence = "ZA";
$result = $mangoPayApi->Users->Create($User);*/
}
$User->CountryOfResidence = "RE";
$result = $api->Users->Create($User);
$_SESSION["MangoPayDemo"]["UserNatural"] = $result->Id;
echo '<pre>' . var_export($result, true) . '</pre>';
echo "<br/>".$_SESSION["MangoPayDemo"]["UserNatural"]."<br/><br/>";
$Wallet = new \MangoPay\Wallet();
$Wallet->Owners = array($_SESSION["MangoPayDemo"]["UserNatural"]);
$Wallet->Description = "Demo wallet for User 1";
$Wallet->Currency = "EUR";
$result = $api->Wallets->Create($Wallet);
echo '<pre>' . var_export($result, true) . '</pre>';
echo "<br/><br/><br/>";
} else {
echo '<pre>' . var_export($john, true) . '</pre>';
$wal = $api->Users->GetWallets("35027132");
//echo '<pre>' . var_export($wal, true) . '</pre>';
foreach ($wal as $k => $v) {
echo $v->Id." : ".$v->Description."<br/>";
}
echo "<br/><br/><br/>";
}
} catch(MangoPay\Libraries\ResponseException $e) {
// handle/log the response exception with code $e->GetCode(), message $e->GetMessage() and error(s) $e->GetErrorDetails()
echo "<br/><br/><br/>";
//echo '<pre>' . var_export($e, true) . '</pre>';
echo $e->GetCode()."<br/><br/>";
echo $e->GetMessage()."<br/><br/>";
echo $e->GetErrorDetails()."<br/><br/>";
} catch(MangoPay\Libraries\Exception $e) {
// handle/log the exception $e->GetMessage()
}
echo "<br/><br/><br/>";
echo $e->GetMessage()."<br/>";
}*/
$params = array( "ClientId" => $api->Config->ClientId );
//$this->renderPartial( "doc/mango" , $params );
//$this->renderPartial( "api/index" , $params );
$this->renderPartial( "paymentDirect/index" , $params );
}
public function actionPay() {
require_once '../../pixelhumain/ph/vendor/autoload.php';
$api = new MangoPay\MangoPayApi();
// configuration
$api->Config->ClientId = Yii::app()->params["mangoPay"]["ClientId"];
$api->Config->ClientPassword = Yii::app()->params["mangoPay"]["ClientPassword"];
$api->Config->TemporaryFolder = Yii::app()->params["mangoPay"]["TemporaryFolder"];
$params = array( "ClientId" => $api->Config->ClientId );
//$this->renderPartial( "doc/mango" , $params );
//$this->renderPartial( "api/index" , $params );
$this->renderPartial( "paymentDirect/payment" , $params );
}
......
......@@ -162,6 +162,9 @@ Liste des notifications déjà lues => #370 #453
* COMOBI
* interop
[ ] connecté une autre instance CO en mode interop
[ ] amélioré le checkExist au remplisage du input NAME
[ ] check also les reseaux FB , Google, twitter
[ ] remplir réseau sociaux
* COPEDIA
[ ] intégré dans un projet global universitaire trans discipline
[ ] voir avec Fred Mesnard et David Grosser , comment l'intégrer dans le cursus , ou meme au LIM
......@@ -278,29 +281,47 @@ Liste des notifications déjà lues => #370 #453
possibilité de plusieurs panels
** idea build dynform based on final json analysis (retro build)
- entry param is a structure similare
** export an Element as MD and import a structured MD file (to be defined)
* ************************************************************
* Version C0.22 : en cours
* ************************************************************
** optim
dynform Localiser
positionner direct sur ma localité
btn validé disparait parfois
fonctionnalité des lieux (module places)
** @Tib
>>>> [ ] when ona page , after login return to same page instead of personnal detail
>>>> [ ] application launcher like linux
>>>> [ ] integration du system de paiement Mango
:totest: [ ] logo de l'element dans le mail d'invite
- co2/test/displayMail/id/59dc95b3dd0452f9308d4af7
>>>> [ ] ajouter Thématique Sport
>>>> [ ] when on a page , after login return to same page instead of personnal detail
>>>> [ ] application launcher + activater like linux
[X] remake error in CO
[X] loading configs from DB applications.key = "devParams || prodParams" > Application::loadDBAppConfig();
[ ] integration du system de paiement Mango
[ ] create User
[ ] create User Wallet
[ ] create Seller
[ ] create seller wallet
[ ] Payin Cash
[ ] creates a CardRegistration
[ ] setle transaction
[ ] build payment interface
>>>> [ ] faciliter la création de page static
[ ] avec du contenu MD
[ ] un slideshow MD
** json config builder
[X] json config builder
- is just dynForm selector
- save allready gets the collection as a param in formatData
- any new saved Element must have a model and it's databinding at least
[X] select type of config ex : "network"
- onclick : openForm of the given type
- this way editing will also work
[ ] subDynform : open a subDF from any DF
[X] subDynform : open a subDF from any DF
- similar to location process
- on click opens a new modal with a dynform inside
[ ] bugs
[ ] btn annulé on subDF
>>>>[ ] removing dynform classes from co.js and lazy load them
>>>>[ ] check webpacking
>>>>[ ] suppression d'un element user type COEDitor
......
......@@ -49,11 +49,13 @@
<div class="col-xs-6">
<h1><span class="text-red">CO</span>DER</h1>
<h2><a href="api" target="_blank" >API</a></h2>
<h2><a href="default/view/page/openSourceWeUse/dir/docs|panels" class="lbhp ">Open Source We Use</a></h2>
<h2><a href="default/view/page/help/dir/docs|panels" class="lbhp">HELP Us Help YOU</a></h2>
<h2><a href="https://chat.lescommuns.org/channel/co_dev_open" target="_blank">Rejoindre la dev</a></h2>
<h2><a href="https://github.com/orgs/pixelhumain" target="_blank">GITHUB</a></h2>
<h2><a href="https://github.com/pixelhumain/communecter/wiki" target="_blank">WIKI DOCS</a></h2>
<h2><a href="https://github.com/pixelhumain/co2/issues" target="_blank">Déclarer des bugs</a></h2>
</div>
<div class="col-xs-6">
......
<?php $this->renderPartial('../docs/panels/menuLink',array("url"=>"default/view/page/links")); ?>
<div class="panel-heading border-light center text-dark partition-white radius-10">
<span class="panel-title homestead"> <i class='fa text-red fa-heart faa-pulse animated fa-3x '></i> <span style="font-size: 48px">OPEN SOURCE PROJECTS WE LOVE AND USE</span></span>
</div>
<div class="space20"></div>
<div class="keywordList col-xs-12"></div>
<script type="text/javascript">
var keywords = [
{
"project" : "Yii PHP Framework",
"url" : "http://www.yiiframework.com",
"comment" : "Yii is a high-performance PHP framework best for developing Web 2.0 applications Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.",
"image" : "https://www.javatpoint.com/yii/images/yii-framework.jpg"
},
{
"project" : "Mongo DB",
"url" : "https://www.mongodb.com/fr",
"comment" : "Réinventons la gestion de l’information, Devenez plus rapide et évolutif grâce à MongoDB, la première base de données NoSQL",
"image" : "https://webassets.mongodb.com/_com_assets/cms/MongoDB-Logo-5c3a7405a85675366beb3a5ec4c032348c390b3f142f5e6dddf1d78e2df5cb5c.png"
},
{
"project" : "JQuery",
"url" : "https://jquery.com/",
"comment" : "jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.",
"image" : "https://blog.netapsys.fr/wp-content/uploads/2016/07/jquery.gif"
},
{
"project" : "Bootstrap",
"url" : "http://getbootstrap.com/",
"comment" : "Build responsive, mobile-first projects on the web with the world's most popular front-end component library.Bootstrap is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with our Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful plugins built on jQuery.",
"image" : "http://getbootstrap.com/assets/img/bootstrap-stack.png"
},
];
jQuery(document).ready(function()
{
$(".keywordList").html('');
$.each(keywords,function(i,obj) {
icon = (obj.icon) ? obj.icon : "fa-tag" ;
color = (obj.color) ? obj.color : "#E33551" ;
$(".keywordList").append(
'<div class="col-xs-3"><div class="keypan panel panel-white">'+
'<div class="panel-heading border-light ">'+
'<span class="panel-title ">'+
'<img class="img-circle" width="50" height="50" src="'+obj.image+'"/> '+
'<a href="'+obj.url+'" target="_blank" style="font-size: 18px; "><br/>'+obj.project.toUpperCase()+'</a>'+
'<span style="font-size: 14px; "><br/>'+obj.comment+'</span>'+
'</span>'+
'</div></div></div>');
});
});
</script>
<?php
/* @var $this SiteController */
/* @var $error array */
$this->pageTitle=Yii::app()->name . ' - Error';
$this->breadcrumbs=array(
'Error',
);
?>
<style>
#error{
font-family: "Homestead";
}
#error h1 {
position:relative;
top:50px;
left:100px;
color: #E6334C;
font-family: "Homestead";
}
#error h2 {
position:relative;
top:70px;
left:100px;
color: #324553;
}
</style>
<div class="container" id="accueil">
<br/>
<!-- Main hero unit for a primary marketing message or call to action -->
<div style="text-align: center;">
<img id="logoERror" width=300 src="<?php echo $this->module->assetsUrl."/images/main-logo-home.png"?>" alt="Logo Pixel Humain"/>
<div id="error">
<div style="margin:30px 0 0 50px;text-align: center;">
<?php if( $error["code"] ){?>
<span style="font-size:2em; color:red; font-weight: bold;">
ERREUR <?php echo $error["code"]?>
<br/><?php
if( isset($error["message"]) )
echo $error["message"];
else
echo Yii::t("common","Oops! You are stuck at",null,Yii::app()->controller->module->id).$error["code"];
?>
</span>
<span style="font-size:2em">
<br/><br/>ERROR, PAGE OR DEMOCRACY NOT FOUND
<br/>QUI CHERCHE FINIT PAR TROUVER
</span>
<?php }?>
<div>
<br/><br/><br/>
<?php echo Yii::t("common","Unfortunately the page you were looking for could not be found.",null,Yii::app()->controller->module->id);?>
<br>
<?php echo Yii::t("common","It may be temporarily unavailable, moved or no longer exist.",null,Yii::app()->controller->module->id);?>
<br>
<?php echo Yii::t("common","Check the URL you entered for any mistakes and try again.",null,Yii::app()->controller->module->id);?>
<br>
<a href="<?php echo Yii::app()->createUrl('/'.$this->module->id);?>" class="btn btn-red btn-return">
<?php echo Yii::t("common","Return home",null,Yii::app()->controller->module->id);?>
</a>
</div>
</div>
</div>
<div class="clear"></div>
<div>
<?php /*if(YII_DEBUG){?>
<?php echo CHtml::encode($message); ?>
<pre><?php echo print_r(debug_backtrace(),true) ?></pre>
<?php }*/?>
</div>
<br/><br/>
</div>
</div>
<?php
/**
* Setting for client: client Id, client password
*/
define('MangoPayDemo_BaseUrl', 'https://api.sandbox.mangopay.com');
define('MangoPayDemo_ClientId', 'sdk-unit-tests');
define('MangoPayDemo_ClientPassword', 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju');
/**
* Path to folder to store temporary files (with permissions to write)
*/
define('MangoPayDemo_TemporaryFolder', __dir__);
\ No newline at end of file
body {
font-size: 12px;
}
#menu {
min-width: 250px;
}
#menu h3 {
font-weight: bold;
font-size: 100%;
}
#menu ul{
padding: 8px 8px 8px 14px;
}
#menu ul li{
padding: 3px 0px;
}
input[type=text] {
width: 250px;
}
select {
width: 256px;
}
\ No newline at end of file
$(document).ready(function(){
$("#menu").accordion( { active: selectedModuleIndex >= 0 ? selectedModuleIndex : false, collapsible : true, heightStyle: "content" } );
});
\ No newline at end of file
<?php
namespace MangoPay\Demo;
//require_once '../../vendor/autoload.php';
require_once 'htmlHelper.php';
require_once 'config.php';
$module = @$_GET['module'];
if (!isset($module))
return;
HtmlHelper::getHeader($module);
$details = explode('_', $module);
$entityName = @$details[0];
$subApiName = @$details[1];
$operation = @$details[2];
$subEntityName = @$details[3];
$filterName = @$details[4];
$subSubEntityName = @$details[5];
$entityId = @$_POST['Id'];
$subEntityId = @$_POST['IdSubEntity'];
if (isset($_POST['_postback']) && $_POST['_postback'] == '1') {
try {
$api = new \MangoPay\MangoPayApi();
$api->Config->BaseUrl = MangoPayDemo_BaseUrl;
$api->Config->ClientId = MangoPayDemo_ClientId;
$api->Config->ClientPassword = MangoPayDemo_ClientPassword;
$api->Config->TemporaryFolder = TemporaryFolder;
$module = @$_GET['module'];
if (isset($module) && strpos($module, '$Sort') !== false) {
if (isset($_POST["_sort_"]) && !empty($_POST["_sort_"])){
$sortFieldName = $_POST["_sort_"];
$sortDirection = $_POST["_sort_direction_"];
if (!isset($sortDirection)) {
$sortDirection = \MangoPay\SortDirection::ASC;
}
$sorting = new \MangoPay\Sorting();
$sorting->AddField($sortFieldName, $sortDirection);
}
}
// normal cases
switch ($operation) {
case '|NoParams|':
$methodName = $subEntityName;
$apiResult = $api->$subApiName->$methodName();
break;
case '|GetWalletTransactions|':
$pagination = HtmlHelper::getEntity('Pagination');
$filter = null;
if (isset($filterName) && $filterName != ""){
$filter = HtmlHelper::getEntity($filterName);
}
$apiResult = $api->$subApiName->GetWalletTransactions(null, null, $pagination, $filter);
print '<pre>';print_r($pagination);print '</pre>';
break;
case '|EnumParams|':
$methodName = $subEntityName;
$enums = explode('$', $subSubEntityName);
if (count($enums) == 1){
$apiResult = $api->$subApiName->$methodName($_POST[$enums[0]]);
} else if (count($enums) == 2) {
$apiResult = $api->$subApiName->$methodName($_POST[$enums[0]], $_POST[$enums[1]]);
}
break;
case '|EnumParamsList|':
$pagination = HtmlHelper::getEntity('Pagination');
$filter = null;
if (isset($filterName) && $filterName != ""){
$filter = HtmlHelper::getEntity($filterName);
}
$methodName = $subEntityName;
$enums = explode('$', $subSubEntityName);
if (count($enums) == 1){
$apiResult = $api->$subApiName->$methodName($_POST[$enums[0]], $pagination, $filter);
} else if (count($enums) == 2) {
$apiResult = $api->$subApiName->$methodName($_POST[$enums[0]], $_POST[$enums[1]], $pagination, $filter);
}
break;
case 'Create':
$entity = HtmlHelper::getEntity($entityName);
$apiResult = $api->$subApiName->Create($entity);
break;
case 'Get':
$apiResult = $api->$subApiName->Get($entityId);
break;
case 'Save':
$entity = HtmlHelper::getEntity($entityName, $entityId);
$apiResult = $api->$subApiName->Update($entity);
break;
case 'SaveNoId':
$entity = HtmlHelper::getEntity($entityName);
$apiResult = $api->$subApiName->Update($entity);
break;
case 'All':
$pagination = HtmlHelper::getEntity('Pagination');
$filter = null;
if (isset($filterName) && $filterName != "")
$filter = HtmlHelper::getEntity($filterName);
if (isset($filter) && !isset($sorting))
$apiResult = $api->$subApiName->GetAll($pagination, $filter);
else if (!isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->GetAll($pagination, $sorting);
else if (isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->GetAll($pagination, $filter, $sorting);
else
$apiResult = $api->$subApiName->GetAll($pagination);
print '<pre>';print_r($pagination);print '</pre>';
if (isset($sorting)) {
print '<pre>Sort: ';print_r($sorting);print '</pre>';
}
break;
case 'CreateSubEntity':
$entity = HtmlHelper::getEntity($subEntityName);
$methodName = 'Create'. $subEntityName;
$apiResult = $api->$subApiName->$methodName($entityId, $entity);
break;
case 'CreateSubSubEntity':
$entity = HtmlHelper::getEntity($subEntityName);
$methodName = 'Create' . $subEntityName;
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId, $entity);
break;
case 'GetSubEntity':
$methodName = 'Get' . $subEntityName;
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId);
break;
case 'SaveSubEntity':
$entity = HtmlHelper::getEntity($subEntityName);
$methodName = 'Update' . $subEntityName;
$apiResult = $api->$subApiName->$methodName($subEntityId, $entity);
break;
case 'ListSubEntity':
case 'ListSubSubEntity':
$pagination = HtmlHelper::getEntity('Pagination');
$methodName = $subEntityName;
$filter = null;
if (isset($filterName) && $filterName != "")
$filter = HtmlHelper::getEntity($filterName);
if ($operation == 'ListSubSubEntity') {
if (isset($filter) && !isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId, $pagination, $filter);
else if (!isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId, $pagination, null, $sorting);
else if (isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId, $pagination, $filter, $sorting);
else
$apiResult = $api->$subApiName->$methodName($entityId, $subEntityId, $pagination);
}else{
if (isset($filter) && !isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $pagination, $filter);
else if (!isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $pagination, null, $sorting);
else if (isset($filter) && isset($sorting))
$apiResult = $api->$subApiName->$methodName($entityId, $pagination, $filter, $sorting);
else
$apiResult = $api->$subApiName->$methodName($entityId, $pagination);
}
print '<pre>';print_r($pagination);print '</pre>';
if (isset($sorting))
print '<pre>Sort: ';print_r($_POST["_sort_"]);print '</pre>';
break;