Answers.Body: <p>Apparently our PHP installation was missing the bcmath package which bccomp() needs. By installing the package via php7.1-bcmath we were able to then process the refunds accordingly. Did not see it here (<a href="https://docs.civicrm.org/sysadmin/en/latest/requirements/" rel="noreferrer">https://docs.civicrm.org/sysadmin/en/latest/requirements/</a>) but I could be missing something?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-28T17:02:05.917Z
Answers.Text: The [docs have now been updated](https://github.com/civicrm/civicrm-sysadmin-guide/pull/203).
Answers.UserDisplayName: HomoTechsual
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-06T19:52:38.603Z
Answers.LastActivityDate: 2019-09-06T20:31:28.813Z
Answers.LastEditDate: 2019-09-06T20:31:28.813Z
Answers.UserDisplayName: Zachary
Body: <p>CiviCRM 5.16.3
  Event uses price sets</p>
  
  <p>Background: We offered a $40.00 price set option for an event that later became free. We created a new price set option for $0.00, disabled the old one, and updated the registration to select the new one. After this, the contribution changed status to 'Pending Refund'. We click more > record refund, the refund due is $40.00, we enter the date, payment method, transaction ID, fee amount, etc. and click 'Record Refund'. The green triangle spins forever, nothing happens, and we do not see an error message in the Civi log viewer or in our error.log from apache. Suggestions for how to proceed?</p>
  
  <p>Update - 9/6/2019. We can make a test contribution as 'Check' and it refunds without a problem. We also created another registration for this event, and paid by check, going through the same pattern, and it was unable to be refunded (same error). Thus, it does not seem to be limited to a payment processor error?</p>
  
  <p>I followed this guide (<a href="https://docs.civicrm.org/dev/en/latest/tools/debugging/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/tools/debugging/</a>) and then enabled various forms of debugging and eventually got the page to display the error:</p>
  
  <blockquote>
    <p>Error: Call to undefined function bccomp() in
    CRM_Financial_BAO_Payment::isPaymentCompletesContribution() (line 545
    of
    /srv/www/www.biodynamics.com/public_html/sites/all/modules/civicrm/CRM/Financial/BAO/Payment.php)</p>
  </blockquote>
  
  <p><a href="https://i.sstatic.net/mSvkS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mSvkS.png" alt="Record Refund"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-05T00:17:34.887Z
Comments.Text: I've seen situations where errors from the card processor don't get displayed and things just spin forever. Try this: instead of clicking and bringing up the overlay form, open in new tab/window. When you submit the form, you might get the error that is being lost in the overlay.
Comments.UserDisplayName: ericG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-05T00:38:16.210Z
Comments.Text: I now get: "Error: The website encountered an unexpected error. Please try again later." no error hits the log with debugging on (it seems)
Comments.UserDisplayName: Zachary
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-05T01:07:51.703Z
Comments.Text: does this have to do with the processor? we manually refunded via iats, and then wanted this to reflect the refund. fyi - i get the same error no matter what 'payment method' i choose
Comments.UserDisplayName: Zachary
Tags: <civievent><civicontribute>
Title: Error: Call to undefined function bccomp() in CRM_Financial_BAO_Payment::isPaymentCompletesContribution()
ThreadText: # Error: Call to undefined function bccomp() in CRM_Financial_BAO_Payment::isPaymentCompletesContribution()
  
  (Asked by: username_0 on 2019-09-04)
  
  CiviCRM 5.16.3
  Event uses price sets
  
  Background: We offered a $40.00 price set option for an event that later became free. We created a new price set option for $0.00, disabled the old one, and updated the registration to select the new one. After this, the contribution changed status to 'Pending Refund'. We click more > record refund, the refund due is $40.00, we enter the date, payment method, transaction ID, fee amount, etc. and click 'Record Refund'. The green triangle spins forever, nothing happens, and we do not see an error message in the Civi log viewer or in our error.log from apache. Suggestions for how to proceed?
  
  Update - 9/6/2019. We can make a test contribution as 'Check' and it refunds without a problem. We also created another registration for this event, and paid by check, going through the same pattern, and it was unable to be refunded (same error). Thus, it does not seem to be limited to a payment processor error?
  
  I followed this guide (<https://docs.civicrm.org/dev/en/latest/tools/debugging/>) and then enabled various forms of debugging and eventually got the page to display the error:
  
  > Error: Call to undefined function bccomp() in
  > CRM\_Financial\_BAO\_Payment::isPaymentCompletesContribution() (line 545
  > of
  > /srv/www/www.biodynamics.com/public\_html/sites/all/modules/civicrm/CRM/Financial/BAO/Payment.php)
  
  [![Record Refund](https://i.sstatic.net/mSvkS.png)](https://i.sstatic.net/mSvkS.png)
  
  **Tags:** civievent, civicontribute
  
  > **Comments:**
  > **username_1**: I've seen situations where errors from the card processor don't get displayed and things just spin forever. Try this: instead of clicking and bringing up the overlay form, open in new tab/window. When you submit the form, you might get the error that is being lost in the overlay.  
  > **username_0**: I now get: "Error: The website encountered an unexpected error. Please try again later." no error hits the log with debugging on (it seems)  
  > **username_0**: does this have to do with the processor? we manually refunded via iats, and then wanted this to reflect the refund. fyi - i get the same error no matter what 'payment method' i choose  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-09-06. Score: 5 | Accepted answer
  
  Apparently our PHP installation was missing the bcmath package which bccomp() needs. By installing the package via php7.1-bcmath we were able to then process the refunds accordingly. Did not see it here (<https://docs.civicrm.org/sysadmin/en/latest/requirements/>) but I could be missing something?
  
  > **Comments:**
  > **username_2**: The [docs have now been updated](https://github.com/civicrm/civicrm-sysadmin-guide/pull/203).  
  
  ---
  
  