Jump to:

113 Posts in 223 Topics by 53 members

Payments and Payment Gateway / APIs

SilverStripe Forums » Payments and Payment Gateway / APIs » transactions support is now broken

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

Moderators: martimiz, Sean, Normann, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2037 Views
  • Tony C
    Avatar
    Community Member
    9 Posts

    transactions support is now broken Link to this post

    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);

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: transactions support is now broken Link to this post

    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

  • Tony C
    Avatar
    Community Member
    9 Posts

    Re: transactions support is now broken Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: transactions support is now broken Link to this post

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

  • Robbo
    Avatar
    Community Member
    3 Posts

    Re: transactions support is now broken Link to this post

    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....

    2037 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.