diff --git a/plugins/fabrik_form/stripe/language/en-GB/en-GB.plg_fabrik_form_stripe.ini b/plugins/fabrik_form/stripe/language/en-GB/en-GB.plg_fabrik_form_stripe.ini index a06f63fbc9d..4500656af72 100644 --- a/plugins/fabrik_form/stripe/language/en-GB/en-GB.plg_fabrik_form_stripe.ini +++ b/plugins/fabrik_form/stripe/language/en-GB/en-GB.plg_fabrik_form_stripe.ini @@ -61,7 +61,11 @@ PLG_FORM_STRIPE_DIALOG_NAME_LABEL="Dialog Name" PLG_FORM_STRIPE_PAY="Pay" PLG_FORM_STRIPE_ZIPCODE_CHECK_DESC="Require user to enter ZIP code in Stripe payment process for verification against card" PLG_FORM_STRIPE_ZIPCODE_CHECK_LABEL="Zip Code Validation" -PLG_FORM_STRIPE_DECLINED="Your payment was declined with the message: %s"; +PLG_FORM_STRIPE_ERROR_DECLINED="Your payment was declined by the Stripe payment processing service with the message: %s"; +PLG_FORM_STRIPE_ERROR_INTERNAL="There was an internal error reported by the Stripe payment processing servers, please try again later." +PLG_FORM_STRIPE_ERROR_RATE_LIMITED="This site has exceeded the rate limiting for Stripe payment processing, please try again later" +PLG_FORM_STRIPE_ERROR_AUTHENTICATION="There was an error aithenticating with the Stripe payment processor, please inform the site administrators" +PLG_FORM_STRIPE_ERROR_NETWORK="This site was unable to connect to the Stripe payment processing servers, please try later" PLG_FORM_STRIPE_CUSTOMERS="Customer Data" PLG_FORM_STRIPE_CUSTOMERS_CONNECTION_DESC="OPTIONAL - connection for Stripe customer ID table" PLG_FORM_STRIPE_CUSTOMERS_CONNECTION_LABEL="Connection" diff --git a/plugins/fabrik_form/stripe/stripe.php b/plugins/fabrik_form/stripe/stripe.php index bdac4820b05..4d19daf8a96 100644 --- a/plugins/fabrik_form/stripe/stripe.php +++ b/plugins/fabrik_form/stripe/stripe.php @@ -231,45 +231,45 @@ public function onBeforeStore() print('Param is:' . $err['param'] . "\n"); print('Message is:' . $err['message'] . "\n"); */ - $this->log('fabrik.form.stripe.charge.declined', json_encode($body)); - $chargeErrMsg = FText::sprintf('PLG_FORM_STRIPE_DECLINED', $err['message']); + $this->doLog('fabrik.form.stripe.charge.declined', json_encode($body)); + $chargeErrMsg = FText::sprintf('PLG_FORM_STRIPE_ERROR_DECLINED', $err['message']); } catch (\Stripe\Error\RateLimit $e) { // Too many requests made to the API too quickly - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_RATE_LIMITED'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_RATE_LIMITED'); } catch (\Stripe\Error\InvalidRequest $e) { // Invalid parameters were supplied to Stripe's API - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_INTERNAL_ERR'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_INTERNAL'); } catch (\Stripe\Error\Authentication $e) { // Authentication with Stripe's API failed // (maybe you changed API keys recently) - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_INTERNAL_ERR'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_AUTHENTICATION'); } catch (\Stripe\Error\ApiConnection $e) { // Network communication with Stripe failed - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_INTERNAL_ERR'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_NETWORK'); } catch (\Stripe\Error\Base $e) { // Display a very generic error to the user, and maybe send // yourself an email - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_INTERNAL_ERR'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_INTERNAL'); } catch (Exception $e) { // Something else happened, completely unrelated to Stripe - $chargeErrMsg = JText::_('PLG_FORM_STRIPE_INTERNAL_ERR'); + $chargeErrMsg = JText::_('PLG_FORM_STRIPE_ERROR_INTERNAL'); } if (!empty($chargeErrMsg)) { - $this->app->enqueueMessage($chargeErrMsg, 'message'); + $formModel->setFormErrorMsg($chargeErrMsg); return false; } @@ -503,7 +503,7 @@ public function getBottomContent() print('Param is:' . $err['param'] . "\n"); print('Message is:' . $err['message'] . "\n"); */ - $this->log('fabrik.form.stripe.charge.declined', json_encode($body)); + $this->doLog('fabrik.form.stripe.charge.declined', json_encode($body)); $chargeErrMsg = FText::sprintf('PLG_FORM_STRIPE_DECLINED', $err['message']); } catch (\Stripe\Error\RateLimit $e) @@ -813,7 +813,7 @@ private function updateCustomerId($userId, $customerId, $opts) } catch (Exception $e) { - $this->log('fabrik.form.stripe.customer.error', $e->getMessage()); + $this->doLog('fabrik.form.stripe.customer.error', $e->getMessage()); $this->app->enqueueMessage($e->getMessage(), 'error'); return false;