Answers.Body: <p>Your symptoms suggest that the issue is some kind of fatal error happening during the job execution itself. I'd recommend you run the job directly via the command line, i.e. something like</p>
  
  <pre><code>drush -u 1 cvapi job.iatsverify
  </code></pre>
  
  <p>And see if there are any errors showing up. Make sure it's the same php version ...</p>
  
  <p>My guess is some curious error that our code isn't handling properly. If you try turning on some logging it might be more instructive.</p>
  
  <p>To answer your other questions:
  1. No, you don't need to schedule a separate cron, it should run okay 'out of the box' (it calls in hourly for verifications, it really wants to tell you when your contributions are actually going through).
  2. Tamar's diagnosis is interesting - I did implement job locking to prevent recurring payments from getting generated multiple times, but that shouldn't affect the verification, which is a separate job and can happen multiple times in parallel without ill effect.
  3. Your civi version doesn't look terrible, but there have been a number of civi core fixes in the 4.6.x recent release that may affect some things, I'd recommend you update your testing platform as well. There is some testing for versions in the iats extension, but doesn't try to manage all the older minor version quirks.</p>
  
  <p>From the comments below: Since you receive a "PHP Fatal error: Class 'SoapClient' not found" when you run the Drush command that means your drush is running a different php environment from your web interface. That's not untypical, you'll just need to inspect your php configurations and make sure that the php cli used by drush also has the soap extension. You can test that by running "php -i | grep soap" for example.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T17:43:32.430Z
Answers.Text: Alan, thank you for your help. I just tried something similar (while you were posting!) and received a PHP Fatal error: Class 'SoapClient' not found (see new addition to original post).  Any idea why there is no error if I manually execute the job from the Scheduled jobs page, but there is an error via Drush?
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T17:50:48.253Z
Answers.Text: I do get the same error as above when I run 'drush cvapi Job.iatsacheftverify sequential=1' from the command line.  And I have verified -- SOAP is enabled per phpinfo().
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T22:07:27.577Z
Answers.Text: So that means your drush is running a different php environment from your web interface. That's not untypical, you'll just need to inspect your php configurations and make sure that the php cli used by drush also has the soap extension. You can test that by running "php -i | grep soap" for example.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-29T04:31:30.467Z
Answers.Text: That did it, thank you Alan!  My website PHP was 5.6, but Drush and the command line were running 5.4.  The Command Line PHP did not have SOAP installed.  I found instructions for my server type and got SOAP enabled for the 5.4 version.  Lo and behold, the normal CiviCRM cron run using Drush successfully finishes the iATS verification job!  Thank you, thank you!
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-29T13:14:30.047Z
Answers.Text: Great. So - to go back to my original answer, it would suggest that our current strategy of identifying the missing SOAP extension isn't enough, i.e. we need better error handling for cases where the cli php is different from the web php.
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-28T17:31:27.753Z
Answers.LastActivityDate: 2016-07-29T04:28:10.110Z
Answers.LastEditDate: 2016-07-29T04:28:10.110Z
Answers.UserDisplayName: Alan Dixon
Body: <p>We're newer to online contributions and are getting ready for go-live soon.  Credit cards with iATS have processed through with no hiccups.  We recently also enabled ACH/EFT via iATS as a payment instrument for our site.  Our first ACH/EFT transaction (from me) went through fine. The transaction was initiated on 7/21/16; both iATS and my personal bank recognize the transaction is now completed as of yesterday, 7/26/16.</p>
  
  <p>However, CiviCRM still showed the transaction's status as <code>Pending (Incomplete Transaction)</code>. The scheduled job for iATS Payments Verification (API Entity: <code>Job</code>; API Action: <code>iatsacheftverify</code>) is enabled and is being processed Hourly (by default; I've changed nothing about the job).  <strong>However, when I view the Job Log, I only see the job starting, never finishing</strong>:</p>
  
  <blockquote>
    <p>Entity: <code>Job</code> Action: <code>iatsacheftverify</code></p>
    
    <p><em>Summary</em></p>
    
    <p>Starting execution of iATS Payments Verification</p>
    
    <p><em>Details</em></p>
    
    <p>Parameters parsed (and passed to API method): 
    a:1:{s:7:"version";i:3;}</p>
    
    <p>Full message:  Starting execution of iATS Payments Verification</p>
  </blockquote>
  
  <p>When I upgraded the iATS extension to 1.5.3 (from 1.5.2) this afternoon and manually executed the job, the job finished and the transaction updated.  Now that a few hours have passed and more hourly jobs ran, it has resumed <em>not</em> working.  I manually executed it again, and the job finished.</p>
  
  <p><strong>So, the issue appears to be that the job finishes when manually executed, but not automatically on its own.  Any ideas on how to proceed?</strong> Do I have to <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-RunaSpecificJobviaURL" rel="nofollow">configure a cron job specific to/for that scheduled job</a>?</p>
  
  <p>The <a href="https://github.com/iATSPayments/com.iatspayments.civicrm" rel="nofollow">iATS requirements (#5)</a> specify: "To handle ACH/EFT Contributions (verification of them) and to handle Recurring Contributions (of any type) you must configure cron for your CiviCRM install. Information about how to do this can be found in: <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs" rel="nofollow">http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs</a>," but I do have cron running.  The iATS Payments Recurring Contributions scheduled job (Entity: <code>Job</code> Action: <code>iatsrecurringcontributions</code>) is running daily (again, by default; I've changed nothing) and has both Starting and Finishing in the Job Log.  For example: </p>
  
  <blockquote>
    <p>Entity: <code>Job</code> Action: <code>iatsrecurringcontributions</code></p>
    
    <p><em>Summary</em> </p>
    
    <p>Finished execution of iATS Payments Recurring Contributions with result:
    Success (No contribution records were processed.)</p>
    
    <p><em>Details</em></p>
    
    <p>Parameters parsed (and passed to API method): 
    a:1:{s:7:"version";i:3;}</p>
    
    <p>Full message:  Finished execution of iATS Payments Recurring
    Contributions with result: Success (No contribution records were
    processed.)</p>
  </blockquote>
  
  <hr>
  
  <p>ADDITION:  If I run <code>job.iatsacheftverify</code> from the API Explorer, I get a success. So I tried adding this scheduled job to my server (from Plesk, CentOS 7, no brackets): <code>drush -r {root folder} -l {website URL} civicrm-api -u {user} job.iatsacheftverify --quiet</code>.  When I ran that job I received this error:</p>
  
  <pre><code>PHP Fatal error: Class 'SoapClient' not found in {ROOT}/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php on line 164
  Drush command terminated abnormally due to an unrecoverable error. [error]
  Error: Class 'SoapClient' not found in
  {ROOT}/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php,
  line 164
  </code></pre>
  
  <p>Line 163-164 of that file:</p>
  
  <pre><code>/* until iATS fixes it's box verify, we need to have trace on to make the hack below work */
  $soapClient = new SoapClient($this-&gt;_wsdl_url, array('trace' =&gt; 1,'soap_version' =&gt; SOAP_1_2));
  </code></pre>
  
  <p>I have no idea what that does. :-)</p>
  
  <p>Civi 4.6.14 (will be updating to 4.6.19 before go-live); Drupal 7.44; iATS Payments extension 1.5.3</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-28T15:40:38.860Z
Comments.Text: Hi Allen, I'm not a developer so please forgive my lack of precise technical instruction, but I have run into this issue before when another scheduled job was causing the global cron to fail before it got to the iATS scheduled job - I believe the jobs are run in sequence as they appear in the scheduled job listing page, so check the last run time stamps  to see if you can identify which job may be the cause. This issue also occurs when there is a grid lock between scheduled jobs - I have just run into the issue in a dev environment where manual execution was starting nut never finishing...
Comments.UserDisplayName: Tamar Meir - Cividesk
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-28T15:41:11.047Z
Comments.Text: If all else fails, @karing should be able to help you the most with this issue
Comments.UserDisplayName: Tamar Meir - Cividesk
Tags: <civicontribute><payment-processor><scheduled-job><iats>
Title: iATS ACH/EFT payment verification scheduled job not finishing
ThreadText: # iATS ACH/EFT payment verification scheduled job not finishing
  
  (Asked by: username_0 on 2016-07-27)
  
  We're newer to online contributions and are getting ready for go-live soon. Credit cards with iATS have processed through with no hiccups. We recently also enabled ACH/EFT via iATS as a payment instrument for our site. Our first ACH/EFT transaction (from me) went through fine. The transaction was initiated on 7/21/16; both iATS and my personal bank recognize the transaction is now completed as of yesterday, 7/26/16.
  
  However, CiviCRM still showed the transaction's status as `Pending (Incomplete Transaction)`. The scheduled job for iATS Payments Verification (API Entity: `Job`; API Action: `iatsacheftverify`) is enabled and is being processed Hourly (by default; I've changed nothing about the job). **However, when I view the Job Log, I only see the job starting, never finishing**:
  
  > Entity: `Job` Action: `iatsacheftverify`
  >
  > *Summary*
  >
  > Starting execution of iATS Payments Verification
  >
  > *Details*
  >
  > Parameters parsed (and passed to API method):
  > a:1:{s:7:"version";i:3;}
  >
  > Full message: Starting execution of iATS Payments Verification
  
  When I upgraded the iATS extension to 1.5.3 (from 1.5.2) this afternoon and manually executed the job, the job finished and the transaction updated. Now that a few hours have passed and more hourly jobs ran, it has resumed *not* working. I manually executed it again, and the job finished.
  
  **So, the issue appears to be that the job finishes when manually executed, but not automatically on its own. Any ideas on how to proceed?** Do I have to [configure a cron job specific to/for that scheduled job](https://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-RunaSpecificJobviaURL)?
  
  The [iATS requirements (#5)](https://github.com/iATSPayments/com.iatspayments.civicrm) specify: "To handle ACH/EFT Contributions (verification of them) and to handle Recurring Contributions (of any type) you must configure cron for your CiviCRM install. Information about how to do this can be found in: <http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs>," but I do have cron running. The iATS Payments Recurring Contributions scheduled job (Entity: `Job` Action: `iatsrecurringcontributions`) is running daily (again, by default; I've changed nothing) and has both Starting and Finishing in the Job Log. For example:
  
  > Entity: `Job` Action: `iatsrecurringcontributions`
  >
  > *Summary*
  >
  > Finished execution of iATS Payments Recurring Contributions with result:
  > Success (No contribution records were processed.)
  >
  > *Details*
  >
  > Parameters parsed (and passed to API method):
  > a:1:{s:7:"version";i:3;}
  >
  > Full message: Finished execution of iATS Payments Recurring
  > Contributions with result: Success (No contribution records were
  > processed.)
  
  ---
  
  ADDITION: If I run `job.iatsacheftverify` from the API Explorer, I get a success. So I tried adding this scheduled job to my server (from Plesk, CentOS 7, no brackets): `drush -r {root folder} -l {website URL} civicrm-api -u {user} job.iatsacheftverify --quiet`. When I ran that job I received this error:
  
  ```
  PHP Fatal error: Class 'SoapClient' not found in {ROOT}/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php on line 164
  Drush command terminated abnormally due to an unrecoverable error. [error]
  Error: Class 'SoapClient' not found in
  {ROOT}/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php,
  line 164
  
  ```
  
  Line 163-164 of that file:
  
  ```
  /* until iATS fixes it's box verify, we need to have trace on to make the hack below work */
  $soapClient = new SoapClient($this->_wsdl_url, array('trace' => 1,'soap_version' => SOAP_1_2));
  
  ```
  
  I have no idea what that does. :-)
  
  Civi 4.6.14 (will be updating to 4.6.19 before go-live); Drupal 7.44; iATS Payments extension 1.5.3
  
  **Tags:** civicontribute, payment-processor, scheduled-job, iats
  
  > **Comments:**
  > **username_1**: Hi username_0, I'm not a developer so please forgive my lack of precise technical instruction, but I have run into this issue before when another scheduled job was causing the global cron to fail before it got to the iATS scheduled job - I believe the jobs are run in sequence as they appear in the scheduled job listing page, so check the last run time stamps  to see if you can identify which job may be the cause. This issue also occurs when there is a grid lock between scheduled jobs - I have just run into the issue in a dev environment where manual execution was starting nut never finishing...  
  > **username_1**: If all else fails, @karing should be able to help you the most with this issue  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-07-28. Score: 2 | Accepted answer
  
  Your symptoms suggest that the issue is some kind of fatal error happening during the job execution itself. I'd recommend you run the job directly via the command line, i.e. something like
  
  ```
  drush -u 1 cvapi job.iatsverify
  
  ```
  
  And see if there are any errors showing up. Make sure it's the same php version ...
  
  My guess is some curious error that our code isn't handling properly. If you try turning on some logging it might be more instructive.
  
  To answer your other questions:
  1. No, you don't need to schedule a separate cron, it should run okay 'out of the box' (it calls in hourly for verifications, it really wants to tell you when your contributions are actually going through).
  2. username_1's diagnosis is interesting - I did implement job locking to prevent recurring payments from getting generated multiple times, but that shouldn't affect the verification, which is a separate job and can happen multiple times in parallel without ill effect.
  3. Your civi version doesn't look terrible, but there have been a number of civi core fixes in the 4.6.x recent release that may affect some things, I'd recommend you update your testing platform as well. There is some testing for versions in the iats extension, but doesn't try to manage all the older minor version quirks.
  
  From the comments below: Since you receive a "PHP Fatal error: Class 'SoapClient' not found" when you run the Drush command that means your drush is running a different php environment from your web interface. That's not untypical, you'll just need to inspect your php configurations and make sure that the php cli used by drush also has the soap extension. You can test that by running "php -i | grep soap" for example.
  
  > **Comments:**
  > **username_0**: username_2, thank you for your help. I just tried something similar (while you were posting!) and received a PHP Fatal error: Class 'SoapClient' not found (see new addition to original post).  Any idea why there is no error if I manually execute the job from the Scheduled jobs page, but there is an error via Drush?  
  > **username_0**: I do get the same error as above when I run 'drush cvapi Job.iatsacheftverify sequential=1' from the command line.  And I have verified -- SOAP is enabled per phpinfo().  
  > **username_2**: So that means your drush is running a different php environment from your web interface. That's not untypical, you'll just need to inspect your php configurations and make sure that the php cli used by drush also has the soap extension. You can test that by running "php -i | grep soap" for example.  
  > **username_0**: That did it, thank you username_2!  My website PHP was 5.6, but Drush and the command line were running 5.4.  The Command Line PHP did not have SOAP installed.  I found instructions for my server type and got SOAP enabled for the 5.4 version.  Lo and behold, the normal CiviCRM cron run using Drush successfully finishes the iATS verification job!  Thank you, thank you!  
  > **username_2**: Great. So - to go back to my original answer, it would suggest that our current strategy of identifying the missing SOAP extension isn't enough, i.e. we need better error handling for cases where the cli php is different from the web php.  
  
  ---
  
  