3 merge requests!51Artfulrobot/stripe fix update webhook,!50Fix update webhook,!49Show system error message instead of crashing if we can't update stripe webhook
* for now, avoid having false alerts that will annoy people).
*
* @see stripe_civicrm_check()
*
* @param array $messages
*
* @return array
* @throws \CiviCRM_API3_Exception
*/
publicstaticfunctioncheck(){
publicstaticfunctioncheck($messages){
$result=civicrm_api3('PaymentProcessor','get',[
'class_name'=>'Payment_Stripe',
'is_active'=>1,
...
...
@@ -48,7 +53,26 @@ class CRM_Stripe_Webhook {
if($wh->url==$webhook_path){
$found_wh=TRUE;
// Check and update webhook
self::checkAndUpdateWebhook($wh);
try{
self::checkAndUpdateWebhook($wh);
}
catch(Exception$e){
$messages[]=newCRM_Utils_Check_Message(
'stripe_webhook',
E::ts('Could not update existing webhook - to fix this delete the existing webhook from your stripe account and re-run this check.<br/>The webhook URL is: %3',[
1=>$paymentProcessor['name'],
2=>$paymentProcessor['id'],
3=>urldecode($webhook_path),
]).'.<br/>Error from Stripe: <em>'.$e->getMessage().'</em>',