Skip to content
Snippets Groups Projects
Commit 8af73c75 authored by mattwire's avatar mattwire
Browse files

Friendly error message when no amount specified on the form

parent 4215ab54
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
* https://civicrm.org/licensing
*/
use CRM_Stripe_ExtensionUtil as E;
/**
* Class CRM_Stripe_AJAX
*/
......@@ -39,7 +41,10 @@ class CRM_Stripe_AJAX {
public static function confirmPayment() {
$paymentMethodID = CRM_Utils_Request::retrieveValue('payment_method_id', 'String');
$paymentIntentID = CRM_Utils_Request::retrieveValue('payment_intent_id', 'String');
$amount = CRM_Utils_Request::retrieveValue('amount', 'Money', NULL, TRUE);
$amount = CRM_Utils_Request::retrieveValue('amount', 'Money');
if (empty($amount)) {
CRM_Utils_JSON::output(['error' => ['message' => E::ts('No amount specified for payment!')]]);
}
$currency = CRM_Utils_Request::retrieveValue('currency', 'String', CRM_Core_Config::singleton()->defaultCurrency);
$processorID = CRM_Utils_Request::retrieveValue('id', 'Integer', NULL, TRUE);
$processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $processorID]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment