Fix for when user cancels Dwolla payment

This commit is contained in:
Hillel Coren 2015-07-01 22:01:12 +03:00
parent 9afd99b245
commit e678d2be62
3 changed files with 13 additions and 1 deletions

View File

@ -200,7 +200,7 @@ class AccountGatewayController extends BaseController
$fields = $gateway->getFields(); $fields = $gateway->getFields();
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields); $optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
if (Utils::isNinja() && $gatewayId == GATEWAY_DWOLLA) { if ($gatewayId == GATEWAY_DWOLLA) {
$optional = array_merge($optional, ['key', 'secret']); $optional = array_merge($optional, ['key', 'secret']);
} }

View File

@ -685,6 +685,14 @@ class PaymentController extends BaseController
$accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type')); $accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'));
$gateway = self::createGateway($accountGateway); $gateway = self::createGateway($accountGateway);
// Check for Dwolla payment error
if ($accountGateway->isGateway(GATEWAY_DWOLLA) && Input::get('error')) {
$errorMessage = trans('texts.payment_error')."\n\n".Input::get('error_description');
Session::flash('error', $errorMessage);
Utils::logError($errorMessage);
return Redirect::to('view/'.$invitation->invitation_key);
}
try { try {
if (method_exists($gateway, 'completePurchase')) { if (method_exists($gateway, 'completePurchase')) {
$details = self::getPaymentDetails($invitation); $details = self::getPaymentDetails($invitation);

View File

@ -34,5 +34,9 @@ class AccountGateway extends EntityModel
public function isPaymentType($type) { public function isPaymentType($type) {
return $this->getPaymentType() == $type; return $this->getPaymentType() == $type;
} }
public function isGateway($gatewayId) {
return $this->gateway_id == $gatewayId;
}
} }