1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Update paypal for fraudnet

This commit is contained in:
David Bomba 2024-08-02 13:07:34 +10:00
parent 1d754758ee
commit c9d1d5f04f
2 changed files with 41 additions and 16 deletions

View File

@ -273,14 +273,14 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
]
];
if($shipping = $this->getShippingAddress()) {
if($shipping = $this->getShippingAddress())
$order['purchase_units'][0]["shipping"] = $shipping;
}
if(isset($data['payment_source'])) {
if(isset($data['payment_source']))
$order['payment_source'] = $data['payment_source'];
}
if(isset($data['payer']))
$order['payer'] = $data['payer'];
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
@ -316,8 +316,17 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
->firstOrFail();
$orderId = $response['orderID'];
$r = $this->gatewayRequest("/v1/checkout/orders/{$orderId}/", 'delete', ['body' => '']);
$data["payer"] = [
"name" => [
"given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name()
],
"email_address" => $this->client->present()->email(),
];
$data['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
$data["payment_source"] = [
"card" => [
@ -393,6 +402,14 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
$data = [];
$this->payment_hash = $payment_hash;
$data["payer"] = [
"name" => [
"given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name()
],
"email_address" => $this->client->present()->email(),
];
$data['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
$data["payment_source"] = [
"card" => [

View File

@ -157,10 +157,6 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
}
public function createOrder(array $data): string
{
@ -173,13 +169,6 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
})->implode("\n");
$order = [
"payer" => [
"name" => [
"given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name()
],
"email_address" => $this->client->present()->email(),
],
"intent" => "CAPTURE",
"payment_source" => $this->getPaymentSource(),
"purchase_units" => [
@ -220,6 +209,10 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
$order['payment_source'] = $data['payment_source'];
}
if(isset($data["payer"])){
$order['payer'] = $data["payer"];
}
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
nlog($r->json());
@ -281,6 +274,13 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
nlog($r->body());
$data["payer"] = [
"name" => [
"given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name()
],
"email_address" => $this->client->present()->email(),
];
$data['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
$data["payment_source"] = [
"card" => [
@ -356,6 +356,14 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
$data = [];
$this->payment_hash = $payment_hash;
$data['payer'] = [
"name" => [
"given_name" => $this->client->present()->first_name(),
"surname" => $this->client->present()->last_name()
],
"email_address" => $this->client->present()->email(),
];
$data['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
$data["payment_source"] = [
"card" => [