|
|
|
|
|
|
|
|
use yii\web\NotFoundHttpException; |
|
|
use yii\web\NotFoundHttpException; |
|
|
use yii\filters\VerbFilter; |
|
|
use yii\filters\VerbFilter; |
|
|
use common\models\User; |
|
|
use common\models\User; |
|
|
|
|
|
use common\models\Etablissement; |
|
|
use c006\paypal_ipn\PayPal_Ipn; |
|
|
use c006\paypal_ipn\PayPal_Ipn; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
$custom = $ipn->getKeyValue('custom'); |
|
|
$custom = $ipn->getKeyValue('custom'); |
|
|
$txn_type = $ipn->getKeyValue('txn_type'); |
|
|
$txn_type = $ipn->getKeyValue('txn_type'); |
|
|
|
|
|
|
|
|
/*$message = '' ; |
|
|
|
|
|
|
|
|
|
|
|
foreach($_POST as $key => $val) { |
|
|
|
|
|
$message .= $key.' : '.$val."\n" ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mail('guillaume.bourgeois13@laposte.net','Données IPN', $message) ;*/ |
|
|
|
|
|
|
|
|
|
|
|
if($txn_type == 'subscr_payment' && $custom) |
|
|
if($txn_type == 'subscr_payment' && $custom) |
|
|
{ |
|
|
{ |
|
|
$user = User::findOne($custom) ; |
|
|
$user = User::findOne($custom) ; |
|
|
|
|
|
|
|
|
$etablissement = Etablissement::findOne($user->id_etablissement) ; |
|
|
$etablissement = Etablissement::findOne($user->id_etablissement) ; |
|
|
if($etablissement) |
|
|
if($etablissement) |
|
|
{ |
|
|
{ |
|
|
$date = $etablissement->date_paiement ; |
|
|
|
|
|
if(!$date) $date = time() ; |
|
|
|
|
|
else $date = strtotime($date) ; |
|
|
|
|
|
|
|
|
|
|
|
$date += 30*24*60*60 ; |
|
|
|
|
|
|
|
|
|
|
|
$etablissement->date_paiement = date('Y-m-d H:i:s',$date) ; |
|
|
|
|
|
|
|
|
$etablissement->date_paiement = date('Y-m-d H:i:s',time()) ; |
|
|
$etablissement->save() ; |
|
|
$etablissement->save() ; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |