plugins/paymethod/paypal/PayPalDAO.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00017 //$Id$
00018 
00019 import('db.DAO');
00020 
00021 class PayPalDAO extends DAO {
00022 
00026    function PayPalDAO() {
00027       parent::DAO();
00028    }
00029 
00030    /*
00031     * Insert a payment into the payments table
00032     */
00033    function insertTransaction($txn_id, $txn_type, $payer_email, $receiver_email, $item_number, $payment_date, $payer_id, $receiver_id) {
00034       $ret = $this->update(
00035          sprintf('INSERT INTO paypal_transactions (
00036             txn_id, 
00037             txn_type, 
00038             payer_email, 
00039             receiver_email, 
00040             item_number, 
00041             payment_date,
00042             payer_id, 
00043             receiver_id) 
00044             VALUES 
00045             (?, ?, ?, ?, ?, %s, ?, ?)',
00046             $this->datetimeToDB($payment_date)
00047          ), 
00048          array(
00049             $txn_id, 
00050             $txn_type, 
00051             $payer_email, 
00052             $receiver_email, 
00053             $item_number, 
00054             $payer_id, 
00055             $receiver_id
00056          ) 
00057       );
00058 
00059       return true;
00060    }
00061 
00062    function transactionExists($txn_id) {
00063       $result =& $this->retrieve(
00064          'SELECT count(*) 
00065             FROM paypal_transactions
00066             WHERE txn_id = ?', 
00067             array($txn_id)
00068       );
00069 
00070       $returner = false;
00071       if (isset($result->fields[0]) && $result->fields[0] >= 1) 
00072          $returner = true;
00073 
00074       $result->Close();
00075       return $returner;    
00076    }
00077 }
00078 
00079 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7