Open venkatavinash opened 6 years ago
Contracts (that is, PHP interfaces) are not directly instantiable. Would you mind sharing your code for confirmPayment()
?
true. i did not checked the code before posting here.
I have changed use Billow\Contracts\PaymentProcessor; to use Billow\Payfast and passed it using public function somthing(Payfast $payfast).
Working fine now.
Is there a need to change the code ? I think so.
Something would be going wrong on your side if the contract does not work. The service provider binds the contract to the Payfast class in the service container (which is why the class works when you pull it in directly). I’d still like to find out why binding the contract is not working on your side… I’ve tested on PHP 7.0/7.1 with L5.5, and it all works fine.
I have used the same code which was given in example.
public function confirmPayment(PaymentProcessor $payfast)
{
// Eloqunet example.
$cartTotal = 9999;
$order = Order::create([
'm_payment_id' => '001', // A unique reference for the order.
'amount' => $cartTotal
]);
// Build up payment Paramaters.
$payfast->setBuyer('first name', 'last name', 'email');
$payfast->setAmount($order->amount);
$payfast->setItem('item-title', 'item-description');
$payfast->setMerchantReference($order->m_payment_id);
// Return the payment form.
return $payfast->paymentForm('Place Order');
}
But I have passed now Request $request and used Payfast $payfast which seems to be working.
Is it not right way to implement?
Hello,
I have included all as described but I am getting the following when I call the route onto PaymentContoller@confirmPayment
Target [Billow\Contracts\PaymentProcessor] is not instantiable.
Arguments "Target [Billow\Contracts\PaymentProcessor] is not instantiable."
any help would be appreciated.
Laravel 5.5 , php 7.0