Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on payment processor creation or update #19

Open
bastienho opened this issue Jun 28, 2023 · 13 comments
Open

Crash on payment processor creation or update #19

bastienho opened this issue Jun 28, 2023 · 13 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@bastienho
Copy link
Contributor

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.

bastienho added a commit to agencenous/org.project60.sepapp that referenced this issue Jun 28, 2023
@bjendres bjendres added the bug Something isn't working label Jun 28, 2023
@bjendres
Copy link
Member

Thanks for reporting @bastienho.

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

@bjendres
Copy link
Member

would you be able to propose a fix?

Oh, sorry, I think you did: #20

@bjendres bjendres added this to the 1.2.x milestone Jun 28, 2023
@bjendres
Copy link
Member

Shoud I release a 1.2.0 version?

@bastienho
Copy link
Contributor Author

Nothing more for me. Fill free to release.

Thanks

@bjendres
Copy link
Member

@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

@bjendres bjendres added the help wanted Extra attention is needed label Jun 28, 2023
@bastienho
Copy link
Contributor Author

Everything sounds good to me.

Thank you for the quick merge.

@bastienho bastienho removed their assignment Jun 29, 2023
@bjendres
Copy link
Member

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

@bastienho
Copy link
Contributor Author

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

@bjendres
Copy link
Member

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
Copy link

eptbertram commented Jan 22, 2024

Is this issue related to #17 ?

@bjendres
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

bjendres commented May 3, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants