public function merchantRecurringAuth($data) { DB::getConn()->transactionStart(); try { $this->AuthAmount = 1.0; $this->write(); $adapter = new DPSAdapter(); $inputs = $this->prepareMerchantHostedRecurringAuthInputs($data); $adapter->doPayment($inputs, $this); DB::getConn()->transactionEnd(); } catch (Exception $e) { DB::getConn()->transactionRollback(); $this->handleError($e); } }
function sendReceipt() { $member = $this->PaidBy(); if ($member->exists() && $member->Email) { $from = DPSAdapter::get_receipt_from(); if ($from) { $body = $this->renderWith($this->ClassName . "_receipt"); $body .= $member->ReceiptMessage(); $email = new Email($from, $member->Email, "Payment receipt (Ref no. #" . $this->ID . ")", $body); $email->send(); } } }
static function set_mode($mode) { self::$mode = $mode; }
function testDBTransaction() { if (self::get_runnable()) { $payment = $this->createARecurringPayment('NZD', '100.00'); $payment->Frequency = 'Monthly'; $payment->StartingDate = date('Y-m-d'); $payment->Times = 100; $payment->write(); $payment->merchantRecurringAuth(self::get_right_cc_data()); if (defined('SS_DATABASE_CLASS') && SS_DATABASE_CLASS == 'PostgreSQLDatabase') { DPSAdapter::set_mode('Rolling_Back_Mode'); $payment->payNext(); DPSAdapter::set_mode('Normal'); } DPSAdapter::set_mode('Error_Handling_Mode'); $payment->payNext(); DPSAdapter::set_mode('Normal'); for ($i = 0; $i < 2; $i++) { $payment->payNext(); } $this->assertType('DataObjectSet', $payment->Payments()); $this->assertType('DataObjectSet', $payment->SuccessPayments()); $this->assertEquals($payment->Payments()->count(), 3); $this->assertEquals($payment->SuccessPayments()->count(), 2); } }