Browse Source

Système de paiement

Mise en place d'un système de paiement via Paypal.
prodstable
keun 8 years ago
parent
commit
336dee7ad7
2 changed files with 17 additions and 1 deletions
  1. +15
    -1
      backend/controllers/PaiementController.php
  2. +2
    -0
      backend/views/paiement/index.php

+ 15
- 1
backend/controllers/PaiementController.php View File

@@ -31,6 +31,11 @@ class PaiementController extends Controller
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['ipn'],
'allow' => true,
'roles' => ['?'],
],
[
'allow' => true,
'roles' => ['@'],
@@ -81,7 +86,7 @@ class PaiementController extends Controller
public function actionIpn()
{
if (isset($_POST)) {
$ipn = new PayPal_Ipn(true);
$ipn = new PayPal_Ipn(false);
if ($ipn->init())
{
/* Get any key/value */
@@ -89,6 +94,15 @@ class PaiementController extends Controller
/*
Add your code here
*/
$message = '' ;

foreach($_POST as $key => $val) {
$message .= $key.' : '.$val."\n" ;
}

mail('guillaume.bourgeois13@laposte.net','Données IPN', $message) ;
}
}
/* Enable again if you use it */

+ 2
- 0
backend/views/paiement/index.php View File

@@ -14,6 +14,7 @@
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="K96K2WLBSBDSA">
<input name="custom" value="<?php echo Yii::$app->user->identity->id; ?>" type="hidden" />
<input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
@@ -22,6 +23,7 @@
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="USASPWAC39S4N">
<input name="custom" value="<?php echo Yii::$app->user->identity->id; ?>" type="hidden" />
<input type="image" src="https://www.sandbox.paypal.com/fr_FR/FR/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal, le réflexe sécurité pour payer en ligne">
<img alt="" border="0" src="https://www.sandbox.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>

Loading…
Cancel
Save