Project60 / org.project60.sepapp

CiviCRM PaymentProcessor for CiviSEPA
Other
4 stars 4 forks source link

Crash on payment processor creation or update #19

Open bastienho opened 1 year ago

bastienho commented 1 year ago

Since CiviCRM 5.61, update or creation of PaymentProcessors always crash with this message:

Couldn't find PaymentProcessorType [xx]

After investigation, it occurs in these lines of sepapp_civicrm_postProcess():

try {
                $pp = civicrm_api3("PaymentProcessor", "getsingle", array("id" => $pp_id));
                if ($pp['class_name'] = "Payment_SDD" || $pp['class_name'] == 'Payment_SDDNG') {
                    $paymentProcessor = civicrm_api3(
                        'PaymentProcessor',
                        'getsingle',
                        array('name' => $form->_submitValues['name'], 'is_test' => 0)
                    );

                    $creditor_id      = $form->_submitValues['user_name'];
                    $test_creditor_id = $form->_submitValues['test_user_name'];
                    $pp_id            = $paymentProcessor['id'];

                    // save settings
                    // FIXME: we might consider saving this as a JSON object
                    CRM_Core_BAO_Setting::setItem($creditor_id, 'SEPA Direct Debit PP', 'pp' . $pp_id);
                    CRM_Core_BAO_Setting::setItem($test_creditor_id, 'SEPA Direct Debit PP', 'pp_test' . $pp_id);
                }
            } catch (Exception $ex) {
                throw new Exception("Couldn't find PaymentProcessorType [{$pp_id}]");
            }
        }

If checked-up the exception, and the message return by $ex->getMessage() is:

Expected one PaymentProcessor but found 11

In fact, there is a breaking change on Contribution CiviCRM 5.61, particulary, this PR.

The name attribute is no more passed, the the PaymentProcessor can't be fetched.

bjendres commented 1 year ago

Thanks for reporting @bastienho.

We currently have any client actively using this extension, would you be able to propose a fix?

bjendres commented 1 year ago

would you be able to propose a fix?

Oh, sorry, I think you did: #20

bjendres commented 1 year ago

Shoud I release a 1.2.0 version?

bastienho commented 1 year ago

Nothing more for me. Fill free to release.

Thanks

bjendres commented 1 year ago

@bastienho I tagged a 1.2-alpha1 version, see attachment. Could please test well and confirm that everything works?

org.project60.sepapp-1.2-alpha1.tar.gz

bastienho commented 1 year ago

Everything sounds good to me.

Thank you for the quick merge.

bjendres commented 1 year ago

Ok, I'll ask you again in a week or so, and then create a release.

bastienho commented 1 year ago

Not sure to understand you last comment. I've tested the 1.2-alpha1 and it worked well.

bjendres commented 1 year ago

Not sure to understand you last comment. I've tested the 1.2-alpha1 and it worked well.

I mean a "proper" 1.2.0 release, no alpha/beta

eptbertram commented 7 months ago

Is this issue related to https://github.com/Project60/org.project60.sepapp/issues/17 ?

bjendres commented 7 months ago

Is this issue related to #17 ?

Possibly. As I mentioned, I don't currently actively work with this extension, so I have no up-to-date information.

bastienho commented 4 months ago

I just figured an unexpected behavior : when editing some non SEPA payment processor, an exception occurs:

Exception: "Couldn't find PaymentProcessorType [xxx]"

It seems to be related to the bad syntax (= instead of ==) in:

($pp['class_name'] = "Payment_SDD" || $pp['class_name'] == 'Payment_SDDNG')
bjendres commented 4 months ago

It seems to be related to the bad syntax (= instead of ==) in:

Oh, wow, you mean this, right?

That's quite the blooper, sorry, could you create a PR?