mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:14:30 -04:00
Merge branch 'paypal_ppcp' of https://github.com/turbo124/invoiceninja into paypal_ppcp
This commit is contained in:
commit
dd9cfe64d6
@ -306,8 +306,6 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
$_invoice = collect($this->payment_hash->data->invoices)->first();
|
$_invoice = collect($this->payment_hash->data->invoices)->first();
|
||||||
|
|
||||||
nlog($_invoice);
|
|
||||||
|
|
||||||
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
||||||
|
|
||||||
$description = collect($invoice->line_items)->map(function ($item){
|
$description = collect($invoice->line_items)->map(function ($item){
|
||||||
@ -323,14 +321,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
"surname" => $this->client->present()->last_name(),
|
"surname" => $this->client->present()->last_name(),
|
||||||
],
|
],
|
||||||
"email_address" => $this->client->present()->email(),
|
"email_address" => $this->client->present()->email(),
|
||||||
"address" => [
|
"address" => $this->getBillingAddress(),
|
||||||
"address_line_1" => $this->client->address1,
|
|
||||||
"address_line_2" => $this->client->address2,
|
|
||||||
"admin_area_2" => $this->client->city,
|
|
||||||
"admin_area_1" => $this->client->state,
|
|
||||||
"postal_code" => $this->client->postal_code,
|
|
||||||
"country_code" => $this->client->country->iso_3166_2,
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"purchase_units" => [
|
"purchase_units" => [
|
||||||
[
|
[
|
||||||
@ -342,6 +333,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
"payment_instruction" => [
|
"payment_instruction" => [
|
||||||
"disbursement_mode" => "INSTANT",
|
"disbursement_mode" => "INSTANT",
|
||||||
],
|
],
|
||||||
|
"shipping" => [
|
||||||
|
"address" => $this->getShippingAddress()
|
||||||
|
],
|
||||||
"amount" => [
|
"amount" => [
|
||||||
"value" => (string)$data['amount_with_fee'],
|
"value" => (string)$data['amount_with_fee'],
|
||||||
"currency_code"=> $this->client->currency()->code,
|
"currency_code"=> $this->client->currency()->code,
|
||||||
@ -375,6 +369,33 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getBillingAddress(): array
|
||||||
|
{
|
||||||
|
return
|
||||||
|
[
|
||||||
|
"address_line_1" => $this->client->address1,
|
||||||
|
"address_line_2" => $this->client->address2,
|
||||||
|
"admin_area_2" => $this->client->city,
|
||||||
|
"admin_area_1" => $this->client->state,
|
||||||
|
"postal_code" => $this->client->postal_code,
|
||||||
|
"country_code" => $this->client->country->iso_3166_2,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getShippingAddress(): array
|
||||||
|
{
|
||||||
|
return $this->company_gateway->require_shipping_address ?
|
||||||
|
[
|
||||||
|
"address_line_1" => $this->client->shipping_address1,
|
||||||
|
"address_line_2" => $this->client->shipping_address2,
|
||||||
|
"admin_area_2" => $this->client->shipping_city,
|
||||||
|
"admin_area_1" => $this->client->shipping_state,
|
||||||
|
"postal_code" => $this->client->shipping_postal_code,
|
||||||
|
"country_code" => $this->client->shipping_country->iso_3166_2,
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
}
|
||||||
|
|
||||||
public function gatewayRequest(string $uri, string $verb, array $data, ?array $headers = [])
|
public function gatewayRequest(string $uri, string $verb, array $data, ?array $headers = [])
|
||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user