mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Paypal response
This commit is contained in:
parent
c4f777b20e
commit
62949b2fad
@ -11,10 +11,12 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
|
use App\Factory\PaymentFactory;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\GatewayType;
|
use App\Models\GatewayType;
|
||||||
|
use App\Models\Payment;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Omnipay\Omnipay;
|
use Omnipay\Omnipay;
|
||||||
|
|
||||||
@ -228,4 +230,15 @@ class BasePaymentDriver
|
|||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createPayment($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
|
||||||
|
$payment->client_id = $this->client->id;
|
||||||
|
$payment->company_gateway_id = $this->company_gateway->id;
|
||||||
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
|
$payment->payment_date = Carbon::now();
|
||||||
|
return $payment;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -61,7 +61,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
|||||||
{
|
{
|
||||||
|
|
||||||
$response = $this->completePurchase($request->all());
|
$response = $this->completePurchase($request->all());
|
||||||
|
\Log::error($request->all());
|
||||||
$transaction_reference = $response->getTransactionReference() ?: $request->input('token');
|
$transaction_reference = $response->getTransactionReference() ?: $request->input('token');
|
||||||
|
|
||||||
if ($response->isCancelled()) {
|
if ($response->isCancelled()) {
|
||||||
@ -69,8 +69,13 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
|||||||
} elseif (! $response->isSuccessful()) {
|
} elseif (! $response->isSuccessful()) {
|
||||||
throw new Exception($response->getMessage());
|
throw new Exception($response->getMessage());
|
||||||
}
|
}
|
||||||
|
//\Log::error(print_r($response,1));
|
||||||
|
//\Log::error(print_r($response->getData()));
|
||||||
|
\Log::error($response->getData());
|
||||||
|
//dd($response);
|
||||||
|
$payment = $this->createPayment($response);
|
||||||
|
|
||||||
|
|
||||||
dd($response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function paymentDetails($input)
|
protected function paymentDetails($input)
|
||||||
@ -168,8 +173,15 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
|||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createPayment($data)
|
public function createPayment($data)
|
||||||
{
|
{
|
||||||
|
$payment = parent::createPayment($data);
|
||||||
|
|
||||||
|
$payment->amount = $this->convertFromStripeAmount($server_response->amount, $this->client->currency->precision);
|
||||||
|
$payment->payment_type_id = PaymentType::PAYPAL;
|
||||||
|
$payment->transaction_reference = $payment_method;
|
||||||
|
$payment->client_contact_id = $this->getContact();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user