CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • New payment processor extension question re: adding a custom cron job
Pages: [1]

Author Topic: New payment processor extension question re: adding a custom cron job  (Read 1861 times)

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
New payment processor extension question re: adding a custom cron job
July 16, 2013, 12:11:26 pm
I've migrated my old IATS payment processor code to a new extension that also uses a different IATS interface.

The new interface doesn't provide the old way of doing recurring contributions, but does allow you to generate 'client codes' when submitting payment requests.

So my new strategy for recurring payments is to submit the request, save the client code, and then make use of the client code in a cron to trigger the subsequent recurring payments.

To add this cron job, I was reading here:
http://wiki.civicrm.org/confluence/display/CRMDOC43/Create+a+Module+Extension#CreateaModuleExtension-Howdoesoneaddacronjob?

and I generated an api function like this:

civix generate:api --schedule=Daily Contribution Create

But when I look at the output, I'm not at all clear what I've just done with that command. I took a look at the new offlinerecurring extension, but it doesn't seem to be using civix.

Any guidance from the cogniscenti?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: New payment processor extension question re: adding a custom cron job
July 16, 2013, 02:20:52 pm
Hi,

So to get a new cron magic, you need two things:
- an api. It's just a matter of creating a new api/v3/Job/Magic.php
that contains a function civicrm_api3_job_magic ($params)
(use the api explorer or drush to see if you can call it as expected)
- a entity cron, that says that every hour/day/month, you call your new api.job.magic
This one can probably be done as a managed entity in the extension, or simply manually created

Your new api will do the needed, your new cronjob will call it whenever needed. Managed entities is a bit on the cutting edge, but works ok. you can as well explain that they need to manually create the cronjob.

Make sense?
X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: New payment processor extension question re: adding a custom cron job
July 17, 2013, 11:22:31 am
Okay, makes sense, sort of ...

So my civix invocation should look like?

civix generate:api --schedule=Daily Job DoRecurIATS

I guess that schedule option is still confusing me because it probably isn't doing anything, as I'm using a CiviCRM 4.2 code base. So I'd need to manually edit my hook file?

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: New payment processor extension question re: adding a custom cron job
October 24, 2013, 09:01:57 pm
I'm attempting the same thing, so I've done:

"It's just a matter of creating a new api/v3/Job/Magic.php
that contains a function civicrm_api3_job_magic ($params)"

But nothing shows up in explorer, cleared caches, disabled, enabled, still nothing shows up.

Any pointers or ideas?

Do we still need to use civix when creating Payment processor extensions or just do what you have described?
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: New payment processor extension question re: adding a custom cron job
October 24, 2013, 09:05:16 pm
A little bit of guidance on where it should show up in explorer would be good to :)
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: New payment processor extension question re: adding a custom cron job
October 25, 2013, 12:58:34 am
I don't think it will show up in explorer even if working - try calling it as a test instead
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: New payment processor extension question re: adding a custom cron job
October 25, 2013, 01:00:58 am
Hi,

from the api explorer, you can directly change the url called, so if you put &entity=job&action=magic, it should work (or return an error message saying it hasn't found the api)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: New payment processor extension question re: adding a custom cron job
October 27, 2013, 09:40:04 pm
Hmm, yes, I get function not found. I've followed the instructions as set out, anything obvious I'm missing?
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: New payment processor extension question re: adding a custom cron job
October 28, 2013, 01:16:26 pm
You know on 4.4 last week I had an api that didn't seem to get picked up- but it was POC so I just jammed it in the main folder. I think now it was probably in the wrong place in the ext structure - it needs to be PATH + api/v3/Entity/Action.php (Or api/v3/Entity.php) & I think I need to check where path is looking
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: New payment processor extension question re: adding a custom cron job
October 28, 2013, 09:03:09 pm
Hi,

Creating new api works, been using that without pb.

Are you creating a "normal" extension or a payment one? if the later, you should convert to a normal extension, as the specialised extensions tend to be more limited and not fire some hooks that are needed.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: New payment processor extension question re: adding a custom cron job
October 30, 2013, 03:11:34 am
Payment… By converting, do you mean I just change the value in the extension's XML file or is there more to it than that?
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: New payment processor extension question re: adding a custom cron job
October 30, 2013, 04:11:42 am
Historically, we have several types of extensions (payment, report, custom search).

Now the right way is to create a "normal" extension as you can do pretty much everything you want, including a payment processor AND get all the hook goodies and being able to create new apis.

Do you have published your extension somewhere? I'm not sure how a payment extension look like right now, but can have a look and see if I remember ;)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: New payment processor extension question re: adding a custom cron job
November 19, 2013, 02:28:21 am
I just hit this again & 'converted' the extension to a module which did fix it - I basically created a module extension using civix & merged the 2 - here is what the PR looks like

https://github.com/fuzionnz/nz.co.fuzion.flo2cashdonate/commit/8a440aa2e214b00dd9a216406d4b53cc0245c29d

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

ChrisChinchilla

  • I post occasionally
  • **
  • Posts: 104
  • Karma: 3
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 6 & 7
Re: New payment processor extension question re: adding a custom cron job
November 20, 2013, 02:48:33 pm
I got things working eventually to… Not even entirely sure what I did… But eWay recurring will be ready very, very soon!
Melbourne CiviCRM meetup group - http://www.meetup.com/MelbourneCiviCRM/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • New payment processor extension question re: adding a custom cron job

This forum was archived on 2017-11-26.