mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:17:32 -05:00 
			
		
		
		
	Update paypal for fraudnet
This commit is contained in:
		
							parent
							
								
									1d754758ee
								
							
						
					
					
						commit
						c9d1d5f04f
					
				@ -273,14 +273,14 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
                ]
 | 
					                ]
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($shipping = $this->getShippingAddress()) 
 | 
				
			||||||
        if($shipping = $this->getShippingAddress()) {
 | 
					 | 
				
			||||||
            $order['purchase_units'][0]["shipping"] = $shipping;
 | 
					            $order['purchase_units'][0]["shipping"] = $shipping;
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(isset($data['payment_source'])) {
 | 
					        if(isset($data['payment_source'])) 
 | 
				
			||||||
            $order['payment_source'] = $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);
 | 
					        $r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -316,8 +316,17 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
                                 ->firstOrFail();
 | 
					                                 ->firstOrFail();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $orderId = $response['orderID'];
 | 
					        $orderId = $response['orderID'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $r = $this->gatewayRequest("/v1/checkout/orders/{$orderId}/", 'delete', ['body' => '']);
 | 
					        $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['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
 | 
				
			||||||
        $data["payment_source"] = [
 | 
					        $data["payment_source"] = [
 | 
				
			||||||
            "card" => [
 | 
					            "card" => [
 | 
				
			||||||
@ -393,6 +402,14 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
        $data = [];
 | 
					        $data = [];
 | 
				
			||||||
        $this->payment_hash = $payment_hash;
 | 
					        $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['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
 | 
				
			||||||
        $data["payment_source"] = [
 | 
					        $data["payment_source"] = [
 | 
				
			||||||
            "card" => [
 | 
					            "card" => [
 | 
				
			||||||
 | 
				
			|||||||
@ -157,10 +157,6 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function createOrder(array $data): string
 | 
					    public function createOrder(array $data): string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -173,13 +169,6 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
        })->implode("\n");
 | 
					        })->implode("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $order = [
 | 
					        $order = [
 | 
				
			||||||
                "payer" => [
 | 
					 | 
				
			||||||
                    "name" => [
 | 
					 | 
				
			||||||
                    "given_name" => $this->client->present()->first_name(),
 | 
					 | 
				
			||||||
                    "surname" => $this->client->present()->last_name()
 | 
					 | 
				
			||||||
                    ],
 | 
					 | 
				
			||||||
                    "email_address" => $this->client->present()->email(),
 | 
					 | 
				
			||||||
                ],
 | 
					 | 
				
			||||||
                "intent" => "CAPTURE",
 | 
					                "intent" => "CAPTURE",
 | 
				
			||||||
                "payment_source" => $this->getPaymentSource(),
 | 
					                "payment_source" => $this->getPaymentSource(),
 | 
				
			||||||
                "purchase_units" => [
 | 
					                "purchase_units" => [
 | 
				
			||||||
@ -220,6 +209,10 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
            $order['payment_source'] = $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);
 | 
					        $r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        nlog($r->json());
 | 
					        nlog($r->json());
 | 
				
			||||||
@ -281,6 +274,13 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        nlog($r->body());
 | 
					        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['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
 | 
				
			||||||
        $data["payment_source"] = [
 | 
					        $data["payment_source"] = [
 | 
				
			||||||
            "card" => [
 | 
					            "card" => [
 | 
				
			||||||
@ -356,6 +356,14 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
 | 
				
			|||||||
        $data = [];
 | 
					        $data = [];
 | 
				
			||||||
        $this->payment_hash = $payment_hash;
 | 
					        $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['amount_with_fee'] = $this->payment_hash->data->amount_with_fee;
 | 
				
			||||||
        $data["payment_source"] = [
 | 
					        $data["payment_source"] = [
 | 
				
			||||||
            "card" => [
 | 
					            "card" => [
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user