mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Complete payment rest API
This commit is contained in:
parent
895bd9dd8f
commit
fd0e4d75ff
@ -87,6 +87,9 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function setPaymentMethod($payment_method_id)
|
public function setPaymentMethod($payment_method_id)
|
||||||
{
|
{
|
||||||
|
if(!$payment_method_id)
|
||||||
|
return $this;
|
||||||
|
|
||||||
$this->paypal_payment_method = $this->funding_options[$payment_method_id];
|
$this->paypal_payment_method = $this->funding_options[$payment_method_id];
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -161,10 +164,10 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function processPaymentResponse($request)
|
public function processPaymentResponse($request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$response = json_decode($request['gateway_response'], true);
|
$response = json_decode($request['gateway_response'], true);
|
||||||
|
|
||||||
if($response['status'] == 'COMPLETED'){
|
if($response['status'] == 'COMPLETED' && isset($response['purchase_units'])){
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_type' => PaymentType::PAYPAL,
|
'payment_type' => PaymentType::PAYPAL,
|
||||||
@ -188,6 +191,17 @@ class PayPalRestPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
['response' => $response],
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||||
|
SystemLog::TYPE_PAYPAL,
|
||||||
|
$this->client,
|
||||||
|
$this->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
throw new PaymentFailed('Payment failed. Please try again.', 401);
|
throw new PaymentFailed('Payment failed. Please try again.', 401);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
<script src="https://www.paypal.com/sdk/js?buyer-country=US¤cy=USD&enable-funding={!! $funding_options !!}&disable-funding=credit,card&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
|
<script src="https://www.paypal.com/sdk/js?buyer-country=US¤cy=USD&enable-funding={!! $funding_options !!}&disable-funding=credit&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user