Unable to Test payment ..
Closed this issue · 1 comments
I have integrated this payment bundle as per documentation ..
It seems to working fine and Paypal Payment gateway form is appearing as below..
First the page come ..
After click on paypal button i found following screen ..
Then i click on pay with debit or credit and following screen like is appeared .
When i filled the test credit card no. from the link .Test Credit Card
and submmitted the form nothing happened ...
Also when i select India in country field following error message come ..
My configuration is like this
jms_payment_core:
secret: XXXXXXXXXXXXXXXXXX
jms_payment_paypal:
username: USER NAME
password: ENCRYPTED PASSWORD
signature: GENERATED SIGNATURE
debug: true
useraction: commit
My controller is like this..
$em = $this->getDoctrine()->getManager();
$order = $em->getRepository('WebmuchTrademarkBundle:PaypalOrder')->find($id);
$config = [
'paypal_express_checkout' => [
'return_url' => $this->generateUrl('paypal_payment_create', ['id' => $order->getId(),], UrlGeneratorInterface::ABSOLUTE_URL),
'cancel_url' => $this->generateUrl('paypal_payment_cancle', ['id' => $order->getId(),], UrlGeneratorInterface::ABSOLUTE_URL),
'useraction' => 'commit'
],
];
$form = $this->createForm('jms_choose_payment_method', null, [
'amount' => $order->getAmount(),
'currency' => 'USD',
'default_method' => 'payment_paypal',
'predefined_data' => $config
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$ppc = $this->get('payment.plugin_controller');
$ppc->createPaymentInstruction($instruction = $form->getData());
$order->setPaymentInstruction($instruction);
$em = $this->getDoctrine()->getManager();
$em->persist($order);
$em->flush($order);
return $this->redirect($this->generateUrl('paypal_payment_create', [
'id' => $order->getId(),
]));
}
and payment creation method is like this ..
$ppc = $this->get('payment.plugin_controller');
$instruction = $order->getPaymentInstruction();
if (null === $pendingTransaction = $instruction->getPendingTransaction()) {
$payment = $ppc->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
} else {
$payment = $pendingTransaction->getPayment();
}
$result = $ppc->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
if (Result::STATUS_PENDING === $result->getStatus()) {
$ex = $result->getPluginException();
if ($ex instanceof ActionRequiredException) {
$action = $ex->getAction();
if ($action instanceof VisitUrl) {
return new RedirectResponse($action->getUrl());
}
throw $ex;
}
} else if (Result::STATUS_SUCCESS !== $result->getStatus()) {
throw new \RuntimeException('Transaction was not successful: '.$result->getReasonCode());
}
return $this->redirect($this->generateUrl('paypal_payment_complete', [
'id' => $order->getId(),
]));
But i m unable to test payment after integration. I do't know whether it is integration problem or it is configuration problem ..
Please suggest me to resolve this issue..
Thanks a lot ..
As the Paypal error message states, the problem is that "buyers having a billing address in India cannot make payments to sellers registered in India". This seems to be a limitation enforced by Paypal and is thus unrelated to this bundle.