Changeset 259
- Timestamp:
- 02/29/08 11:13:21 (5 years ago)
- Location:
- donation/optionals/de.easy-coding.wcf.donation.paypal
- Files:
-
- 3 modified
-
eventlistener.xml (modified) (1 diff)
-
files/lib/system/event/listener/DonationAddFormPayPalListener.class.php (modified) (5 diffs)
-
templates/donationPayPal.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
donation/optionals/de.easy-coding.wcf.donation.paypal/eventlistener.xml
r255 r259 18 18 <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile> 19 19 </eventlistener> 20 <eventlistener>21 <eventclassname>DonationAddForm</eventclassname>22 <eventname>readFormParameters</eventname>23 <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile>24 </eventlistener>25 <eventlistener>26 <eventclassname>DonationAddForm</eventclassname>27 <eventname>save</eventname>28 <listenerclassfile>lib/system/event/listener/DonationAddFormPayPalListener.class.php</listenerclassfile>29 </eventlistener>30 20 <!-- admin --> 31 21 <eventlistener> -
donation/optionals/de.easy-coding.wcf.donation.paypal/files/lib/system/event/listener/DonationAddFormPayPalListener.class.php
r255 r259 15 15 16 16 //data 17 protected $arr = array('paypal_enable','paypal_ code');17 protected $arr = array('paypal_enable','paypal_business', 'paypal_auth_token', 'paypal_item_name', 'paypal_amount_type', 'paypal_amount_default', 'paypal_amount_select', 'paypal_currency', 'paypal_img'); 18 18 19 19 /** 20 * 20 * paypal check 21 21 */ 22 22 protected function validatePaypal() { … … 25 25 26 26 $tx_token = $_GET['tx']; 27 $auth_token = "GX_sTf5bW3wxRfFEbgofs88nQxvMQ7nsI8m21rzNESnl_79ccFTWj2aPgQ0";27 $auth_token = $this->data['paypal_auth_token']; 28 28 $req .= "&tx=$tx_token&at=$auth_token"; 29 29 … … 68 68 // check that txn_id has not been previously processed 69 69 // check that receiver_email is your Primary PayPal email 70 if($keyarray['business'] != $this->data['paypal_business']) { 71 return false; 72 } 70 73 // check that payment_amount/payment_currency are correct 74 if($keyarray['payment_gross'] <= 0) { 75 return false; 76 } 71 77 // process payment 72 $firstname = $keyarray['first_name'];73 $lastname = $keyarray['last_name'];74 78 $itemname = $keyarray['item_name']; 75 $amount = $keyarray['payment_gross'];76 $currency = $keyarray['mc_currency'];77 $text = urldecode($keyarray['custom']);78 79 79 echo ("<p><h3>Thank you for your purchase!</h3></p>"); 80 81 echo ("<b>Payment Details</b><br>\n"); 82 echo ("<li>Name: $firstname $lastname</li>\n"); 83 echo ("<li>Item: $itemname</li>\n"); 84 echo ("<li>Amount: $amount</li>\n"); 85 echo (""); 80 $this->username = $keyarray['last_name'].', '.$keyarray['first_name']; 81 $this->present['amount'] = $keyarray['payment_gross']; 82 $this->present['currency'] = $keyarray['mc_currency']; 83 $this->present['mail'] = $keyarray['payer_email']; 84 $this->message = urldecode($keyarray['custom']); 85 86 WCF::getTPL()->assign(array( 87 'pageurl'=>WCF::getLanguage()->get('wcf.donation.paypal.thanks') 88 )); 86 89 87 90 fclose ($fp); … … 97 100 return false; 98 101 } 99 102 100 103 /** 101 * @see Form:: readFormParameters()104 * @see Form::assignVariables() 102 105 */ 103 protected function readFormParameters() { 104 //TODO: get information from paypal 106 protected function assignVariables() { 107 WCF::getTPL()->assign(array( 108 'pageurl'=>FileUtil::addTrailingSlash(PAGE_URL) 109 )); 110 parent::assignVariables(); 105 111 } 106 112 … … 109 115 */ 110 116 protected function validate() { 111 // TODO:did we get an answer from paypal? submission finished?117 // did we get an answer from paypal? submission finished? 112 118 switch($this->eventObj->step) { 113 119 case 10: // return page 114 120 if($this->validatePaypal()) { 115 EventListener::fireEvent($this->eventObj, 'save'); //TODO: EventListener121 $this->save(); 116 122 } 117 123 -
donation/optionals/de.easy-coding.wcf.donation.paypal/templates/donationPayPal.tpl
r257 r259 14 14 <input type="hidden" name="tax" value="0"/> 15 15 <input type="hidden" name="bn" value="PP-DonationsBF"/> 16 {if paypal_amount_type == "hidden"}16 {if $paypal_amount_type == "hidden"} 17 17 <input type="hidden" name="amount" value="{$paypal_amount_default}"/> 18 {elseif paypal_amount_type == "default"}18 {elseif $paypal_amount_type == "default"} 19 19 <input type="text" name="amount" value="{$paypal_amount_default}"/> {$paypal_currency} 20 {elseif paypal_amount_type == "select"}20 {elseif $paypal_amount_type == "select"} 21 21 <select name="amount"> 22 {foreach $paypal_amount_select item=amount}22 {foreach from=$paypal_amount_select item=amount} 23 23 <option value=""{if $paypal_amount_default == $amount} selected="selected"{/if}>{$amount} {$paypal_currency}</option> 24 24 {/foreach}
