[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bwebsites/jointhegame-kde-org/paypal=5Fstandard=5Fpa?=
From: Emil Sedgh <emilsedgh () gmail ! com>
Date: 2011-06-17 10:30:05
Message-ID: 20110617103005.580D0A60A4 () git ! kde ! org
[Download RAW message or body]
Git commit 4e51297868407b4777514fd6894918f241c4b0f8 by Emil Sedgh.
Committed on 17/06/2011 at 12:26.
Pushed by esedgh into branch 'paypal_standard_payment'.
initializing standard button payments.
D +0 -57 protected/controllers/PaypalController.php
A +57 -0 protected/controllers/paypal/ExpressController.php
A +6 -0 protected/controllers/paypal/StandardController.php
M +14 -1 protected/models/Payment.php
A +16 -0 protected/views/payment/paypal/standard/button.php
http://commits.kde.org/websites/jointhegame-kde-org/4e51297868407b4777514fd6894918f241c4b0f8
diff --git a/protected/controllers/PaypalController.php \
b/protected/controllers/PaypalController.php deleted file mode 100644
index 71f1295..0000000
--- a/protected/controllers/PaypalController.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-Class PaypalController Extends Controller {
- public function accessRules() {
- return Array(
- array(
- 'allow',
- 'actions' => array('start', 'resume'),
- 'users' => array('@')
- ),
-
- array(
- 'allow',
- 'actions' => array('recurringprofile', 'recurringprofiles'),
- 'roles' => array('admin')
- ),
-
- array(
- 'deny'
- )
- );
- }
-
- public function actionStart() {
- $payment = Yii::app()->session->get('paypal');
-
- if($_POST['PaypalPayment']['isRecurring']) {
- $payment->isRecurring = True;
- }
-
- $payment->start();
- }
-
- public function actionResume() {
- $paypal = Yii::app()->session->get('paypal');
- $paypal->token = $_GET['token'];
-
- $result = $paypal->saveAutomatically();
-
- if($result)
- $this->redirect($paypal->redirectUrl);
- }
-
- public function actionRecurringProfiles() {
- $this->render('/payment/paypal/recurring_profiles');
- }
-
- public function actionRecurringProfile() {
- $model = PaypalRecurringProfile::model()->findByPK($_GET['id']);
- $model->update();
-
- $this->title = Yii::t('payment', 'Recurring payment for :fullName', array(
- ':fullName' => $model->owner->fullName
- ));
-
- $this->render('/payment/paypal/recurring_profile', array('model' => $model));
- }
-}
\ No newline at end of file
diff --git a/protected/controllers/paypal/ExpressController.php \
b/protected/controllers/paypal/ExpressController.php new file mode 100644
index 0000000..71f1295
--- /dev/null
+++ b/protected/controllers/paypal/ExpressController.php
@@ -0,0 +1,57 @@
+<?php
+Class PaypalController Extends Controller {
+ public function accessRules() {
+ return Array(
+ array(
+ 'allow',
+ 'actions' => array('start', 'resume'),
+ 'users' => array('@')
+ ),
+
+ array(
+ 'allow',
+ 'actions' => array('recurringprofile', 'recurringprofiles'),
+ 'roles' => array('admin')
+ ),
+
+ array(
+ 'deny'
+ )
+ );
+ }
+
+ public function actionStart() {
+ $payment = Yii::app()->session->get('paypal');
+
+ if($_POST['PaypalPayment']['isRecurring']) {
+ $payment->isRecurring = True;
+ }
+
+ $payment->start();
+ }
+
+ public function actionResume() {
+ $paypal = Yii::app()->session->get('paypal');
+ $paypal->token = $_GET['token'];
+
+ $result = $paypal->saveAutomatically();
+
+ if($result)
+ $this->redirect($paypal->redirectUrl);
+ }
+
+ public function actionRecurringProfiles() {
+ $this->render('/payment/paypal/recurring_profiles');
+ }
+
+ public function actionRecurringProfile() {
+ $model = PaypalRecurringProfile::model()->findByPK($_GET['id']);
+ $model->update();
+
+ $this->title = Yii::t('payment', 'Recurring payment for :fullName', array(
+ ':fullName' => $model->owner->fullName
+ ));
+
+ $this->render('/payment/paypal/recurring_profile', array('model' => $model));
+ }
+}
\ No newline at end of file
diff --git a/protected/controllers/paypal/StandardController.php \
b/protected/controllers/paypal/StandardController.php new file mode 100644
index 0000000..943a741
--- /dev/null
+++ b/protected/controllers/paypal/StandardController.php
@@ -0,0 +1,6 @@
+<?php
+Class StandardController Extends Controller {
+ public function actionResume() {
+ var_dump($_POST);
+ }
+}
\ No newline at end of file
diff --git a/protected/models/Payment.php b/protected/models/Payment.php
index 055689b..c4c823d 100644
--- a/protected/models/Payment.php
+++ b/protected/models/Payment.php
@@ -32,7 +32,7 @@ Class Payment Extends CActiveRecord {
}
public static function getMethods() {
- return Array(New ManualPaypalPayment, New DirectTransferPayment, New \
DirectDebitAuthorizationPayment); + return Array(New StandardPaypalPayment, New \
DirectTransferPayment, New DirectDebitAuthorizationPayment); }
public static function getPeriods() {
@@ -165,4 +165,17 @@ Class ManualPaypalPayment Extends Payment {
$this->save();
Yii::app()->controller->redirect($redirectUrl);
}
+}
+
+Class StandardPaypalPayment Extends Payment {
+ public function getTitle() {
+ return Yii::t('payment', 'Paypal (automatic)');
+ }
+
+ public function pay($redirectUrl) {
+ Yii::app()->controller->render('/payment/paypal/standard/button', array(
+ 'model' => $this,
+ 'redirectUrl' => $redirectUrl
+ ));
+ }
}
\ No newline at end of file
diff --git a/protected/views/payment/paypal/standard/button.php \
b/protected/views/payment/paypal/standard/button.php new file mode 100644
index 0000000..b79e78f
--- /dev/null
+++ b/protected/views/payment/paypal/standard/button.php
@@ -0,0 +1,16 @@
+<!-- <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
+<input type="hidden" name="cmd" value="_s-xclick">
+<input type="hidden" name="hosted_button_id" value="FW4KZH8CBKGHE">
+<input type="image" \
src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_US/i/btn/btn_donateCC_LG.gif" \
border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> +<img \
alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_US/i/scr/pixel.gif" \
width="1" height="1"> +</form> !-->
+
+<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
+ <input type="hidden" name="business" \
value="emilse_1295956867_biz@gmail.com" /> + <input type="hidden" \
name="cmd" value="_donations" /> + <input type="hidden" name="return" \
value="<?php echo Yii::app()->createAbsoluteUrl('/paypal/standard/resume'); ?>" /> + \
<input type="hidden" name="amount" value="<?php echo $model->amount; ?>" /> + \
<input type="hidden" name="currency_code" value="EUR" /> + <input \
type="image" name="submit" border="0" \
src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" alt="PayPal - The safer, \
easier way to pay online" /> + <img alt="" border="0" width="1" \
height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" /> +</form>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic