Skip to content

Commit

Permalink
fix StyleCi
Browse files Browse the repository at this point in the history
  • Loading branch information
BFoucher committed Sep 20, 2016
1 parent def4b0c commit ec907d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
31 changes: 16 additions & 15 deletions Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public function newAction(Request $request, $order)

return $this->render(
'AppVentusMangopayBundle::cardPayment.html.twig',
array(
'form' => $form->createView(),
[
'form' => $form->createView(),
'order' => $order,
)
]
);
}

Expand Down Expand Up @@ -87,13 +87,13 @@ public function paymentFinalizeAction(Request $request, $orderId, $cardId)
// Handle error
if ((property_exists($updatedCardRegister, 'ResultCode')
&& $updatedCardRegister->ResultCode !== '000000')
|| $updatedCardRegister->Status == 'ERROR') {
|| $updatedCardRegister->Status == 'ERROR') {
$errorMessage = $this->get('translator')->trans('mangopay.error.'.$updatedCardRegister->ResultCode);

return new JsonResponse(array(
return new JsonResponse([
'success' => false,
'message' => $errorMessage,
));
]);
}

// Create a PayIn
Expand All @@ -103,17 +103,17 @@ public function paymentFinalizeAction(Request $request, $orderId, $cardId)
if ((property_exists($preAuth, 'Code') && $preAuth->Code !== 200) || $preAuth->Status == 'FAILED') {
$errorMessage = $this->get('translator')->trans('mangopay.error.'.$preAuth->ResultCode);

return new JsonResponse(array(
return new JsonResponse([
'success' => false,
'message' => $errorMessage,
));
]);
}
// Handle secure mode
if (property_exists($preAuth, 'SecureModeNeeded') && $preAuth->SecureModeNeeded == 1) {
return new JsonResponse(array(
'success' => true,
return new JsonResponse([
'success' => true,
'redirect' => $preAuth->SecureModeRedirectURL,
));
]);
}

// store payin transaction
Expand All @@ -134,9 +134,9 @@ public function paymentFinalizeAction(Request $request, $orderId, $cardId)
$this->get('translator')->trans('appventus_mangopay.alert.pre_authorisation.success')
);

return new JsonResponse(array(
return new JsonResponse([
'success' => true,
));
]);
}

/**
Expand Down Expand Up @@ -198,18 +198,19 @@ public function paymentFinalizeSecureAction(Request $request, $orderId)

/**
* @param Request $request The request
* @param int $orderId
* @param int $orderId
*
* This method shows the congratulations
*
* @Route("/success/{orderId}", name="appventus_mangopaybundle_payment_success")
*
* @return Response
*/
public function successAction(Request $request, $orderId)
{
return $this->render(
'AppVentusMangopayBundle::success.html.twig',
[ 'orderId' => $orderId ]
['orderId' => $orderId]
);
}
}
16 changes: 8 additions & 8 deletions Helper/PaymentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ public function prepareCardRegistrationCallback(User $user, Order $order)

$redirect = $this->router->generate(
'appventus_mangopaybundle_payment_finalize',
array(
[
'orderId' => $order->getId(),
'cardId' => $mangoCardRegistration->Id,
)
'cardId' => $mangoCardRegistration->Id,
]
);

$successRedirect = $this->generateSuccessUrl($order->getId());

return array(
return [
'callback' => 'payAjaxOrRedirect("'
.$redirect.'", "'
.$redirect.'", "'
.$cardRegistrationURL.'", "'
.$preregistrationData.'", "'
.$accessKey.'", "'
.$successRedirect.'")',
);
];
}

/**
Expand Down Expand Up @@ -110,9 +110,9 @@ public function createPreAuthorisation(CardRegistration $updatedCardRegister, Us
$cardPreAuthorisation->SecureMode = 'DEFAULT';
$cardPreAuthorisation->SecureModeReturnURL = $this->router->generate(
'appventus_mangopaybundle_payment_finalize_secure',
array(
[
'orderId' => $order->getId(),
),
],
true
);

Expand All @@ -125,6 +125,7 @@ public function createPreAuthorisation(CardRegistration $updatedCardRegister, Us

return $preAuth;
}

/**
* execute a pre authorisation.
*
Expand Down Expand Up @@ -199,5 +200,4 @@ public function generateSuccessUrl($orderId)
{
return $this->router->generate('appventus_mangopaybundle_payment_success', ['orderId' => $orderId]);
}

}

0 comments on commit ec907d0

Please sign in to comment.