Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Payments and Payment Gateway / APIs /

This is a forum for discussing SilverStripe can-do payments and their APIs / Gateways.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

transactions support is now broken


Go to End


5 Posts   3433 Views

Avatar
Tony C

Community Member, 9 Posts

18 January 2011 at 11:33am

I am using postgresql and startTransaction() etc has been renamed transactionStart() etc on trunk for consistency purposes. I have fixed and have a diff patch for the payment module. I can't seem to upload it as an attachment here. Does anyone want it? inline.....

Index: code/DPSPayment/DPSAdapter.php
===================================================================
--- code/DPSPayment/DPSAdapter.php (revision 115626)
+++ code/DPSPayment/DPSAdapter.php (working copy)
@@ -576,7 +576,7 @@
$xml = new SimpleXMLElement($request_string);
$urls = $xml->xpath('//URI');
$url = $urls[0].'';
- DB::getConn()->endTransaction();
+ DB::getConn()->transactionEnd();
if(self::$mode == "Unit_Test_Only"){
return $url;
}else{
@@ -617,7 +617,7 @@
}

if($payment) {
- DB::getConn()->startTransaction();
+ DB::getConn()->transactionStart();
try{
$payment->ResponseXML = $rsp->toXml();
$success = $rsp->getSuccess();
@@ -631,7 +631,7 @@
}
$payment->Message=$rsp->getResponseText();
$payment->write();
- DB::getConn()->endTransaction();
+ DB::getConn()->transactionEnd();
}catch(Exception $e){
DB::getConn()->transactionRollback();
$payment->handleError($e);
Index: code/DPSPayment/DPSPayment.php
===================================================================
--- code/DPSPayment/DPSPayment.php (revision 115626)
+++ code/DPSPayment/DPSPayment.php (working copy)
@@ -143,7 +143,7 @@
$adapter = new DPSAdapter();
$inputs = $this->prepareAuthInputs($data);
$adapter->doPayment($inputs, $this);
- DB::getConn()->endTransaction();
+ DB::getConn()->transactionEnd();
}catch(Exception $e){
DB::getConn()->transactionRollback();
$this->handleError($e);
@@ -168,7 +168,7 @@
}

function complete(){
- DB::getConn()->startTransaction();
+ DB::getConn()->transactionStart();
try{
$auth = $this->AuthPayment();
$this->TxnType = "Complete";
@@ -178,7 +178,7 @@
$adapter = new DPSAdapter();
$inputs = $this->prepareCompleteInputs();
$adapter->doPayment($inputs, $this);
- DB::getConn()->endTransaction();
+ DB::getConn()->transactionEnd();
}catch(Exception $e){
DB::getConn()->transactionRollback();
$this->handleError($e);
@@ -241,7 +241,7 @@
}

function dpshostedPurchase($data){
- DB::getConn()->startTransaction();
+ DB::getConn()->transactionStart();
try{
$this->TxnType = "Purchase";
$this->write();
Index: code/DPSPayment/DPSRecurringPayment.php
===================================================================
--- code/DPSPayment/DPSRecurringPayment.php (revision 115626)
+++ code/DPSPayment/DPSRecurringPayment.php (working copy)
@@ -77,7 +77,7 @@
}

function recurringAuth($data){
- DB::getConn()->startTransaction();
+ DB::getConn()->transactionStart();
try{
$this->TxnType = "Auth";
$this->AuthAmount = 1.00;
@@ -114,7 +114,7 @@
}

function merchantRecurringAuth($data){
- DB::getConn()->startTransaction();
+ DB::getConn()->transactionStart();
try{
$this->AuthAmount = 1.00;
$this->write();
@@ -122,7 +122,7 @@
$adapter = new DPSAdapter();
$inputs = $this->prepareMerchantHostedRecurringAuthInputs($data);
$adapter->doPayment($inputs, $this);
- DB::getConn()->endTransaction();
+ DB::getConn()->transactionEnd();
}catch(Exception $e){
DB::getConn()->transactionRollback();
$this->handleError($e);

Avatar
Willr

Forum Moderator, 5523 Posts

18 January 2011 at 4:35pm

Hi Tony,

For patches and other fixes like this I recommend submitting it as a patch issue to either open.silverstripe.org (as payment at this time of writing has not been migrated) or once payment appears on https://github.com/silverstripe-labs then submit a pull request.

http://doc.silverstripe.org/sapphire/en/misc/contributing#submiting-patches-bugfixes-and-enhancements

Avatar
Tony C

Community Member, 9 Posts

18 January 2011 at 7:32pm

Hi Will,

I kind of thought that would be the case, but with all the migration stuff happening I just wasn't sure what to do. Things do seem a bit chaotic at the moment and when fixes go in one place and then don't get rolled into dependent modules (in a different VCS) it doesn't help!

I'll wait until payment gets migrated to git.

Avatar
Willr

Forum Moderator, 5523 Posts

6 April 2011 at 7:55pm

Everything should all be on git as of a month of so ago. svn is now readonly.

Avatar
Robbo

Community Member, 3 Posts

26 April 2011 at 4:54pm

Tony, so glad you posted this here, I have just downloaded the payment module and the latest silverstripe and was getting the error:

Fatal error: Call to undefined method MySQLDatabase::transactionStart() in C:\xampp\htdocs\hireme\payment\code\DPSPayment\DPSPayment.php on line 244

Wasn't sure what was going on. but all you have to do is change transactionStart to startTransaction

Its hard to know whats going on with SS sometimes....