Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

contribution_recur_id in API3 expects integer not string #64

Closed
TomCrawshaw opened this issue Dec 23, 2019 · 10 comments
Closed

contribution_recur_id in API3 expects integer not string #64

TomCrawshaw opened this issue Dec 23, 2019 · 10 comments

Comments

@TomCrawshaw
Copy link
Contributor

In line 365 of GoCardlessUtils.php (an api3 call), contribution_status_id is set to "In Progress", rather than the numeric value "5", as seems to be expected by the api. This causes a "not a valid integer" error. Setting contribution_status = "In Progress" works.

Is this an error in the code, or am I misunderstanding the api3?

@artfulrobot
Copy link
Owner

artfulrobot commented Dec 24, 2019

@TomCrawshaw

Link to referenced line in 1.9beta

I don't see this error, and testing with the APIv3 explorer leads to setting contribution_recur_id by the name and works for both create and update(i.e. create while also supplying an ID).

What version of CiviCRM are you running?

@TomCrawshaw
Copy link
Contributor Author

TomCrawshaw commented Dec 24, 2019 via email

@artfulrobot
Copy link
Owner

Very odd. You haven't deleted 'In Progress' somehow, have you? You're not using civirules with something triggering on/affecting recur records are you?

@TomCrawshaw
Copy link
Contributor Author

TomCrawshaw commented Dec 29, 2019 via email

@artfulrobot
Copy link
Owner

artfulrobot commented Dec 31, 2019

@TomCrawshaw you should not change the contribution status directly - suggest you change it back asap. The reason for this is that there is a world of financial transaction data below the contribution record that will become corrupt if you change the status directly without going through the API. Also individual contribs should not have an In Progress status. N.b. you can mess around with the contribution recur status with fewer side effects at the mo, but the contribution status is sensitive.

The code you linked to is setting the contribution recur status, not a contribution status - the two sets of statuses are actually separate (though historically they have been equivalent),

Yes, (from memory) the contribution results show the contrib status not the contrib recur status.

Do you have access to the API explorer (v3)? or the command line cv tool? If so, identify a test contrib recur record and try setting its status to "In Progress"

cv api ContributionRecur.create id=<NUMERIC_ID_GOES_HERE> contribution_status_id="In Progress" 

see if you get the same error. (if successful you can use a similar command to change it back again to whatever it was)

You could also double check that this returns a the option:

cv api OptionValue.getsingle sequential=1 option_group_id="contribution_recur_status" name="In Progress" is_active=1 

@TomCrawshaw
Copy link
Contributor Author

TomCrawshaw commented Dec 31, 2019 via email

@artfulrobot
Copy link
Owner

...and what does running the other cv command give? (sorry I think I edited that in and I notice you're replying by email, so you may have missed it)

@TomCrawshaw
Copy link
Contributor Author

Yes, I did miss it.. Here is the response:

{
"id": "1377",
"option_group_id": "127",
"label": "In Progress",
"value": "5",
"name": "In Progress",
"weight": "5",
"is_optgroup": "0",
"is_reserved": "1",
"is_active": "1"
}

@artfulrobot
Copy link
Owner

That's so weird. I think it's a bit off topic - it's not to do with the GoCardless extension, as far as I can see, unless there's something very odd going on. But I've asked on mattermost

@artfulrobot
Copy link
Owner

I'm going to close this as I don't think it's specific to this extension. The fact that this happens suggests it's something odd about your install - as as far as I'm aware, that API call is unrelated to any particular payment processor. Good luck! And feel free to re-open if it does turn out to be something to do with this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants