Changeset 259 for donation/optionals/de.easy-coding.wcf.donation.paypal/files/lib/system/event/listener/DonationAddFormPayPalListener.class.php
- Timestamp:
- 02/29/08 11:13:21 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
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
