From 3b6b1c53e73fe17be8ad227ca1e6a72ee8d19517 Mon Sep 17 00:00:00 2001 From: devansh bawari Date: Mon, 12 Apr 2021 12:14:54 +0530 Subject: [PATCH] Paypal Partner Attribution ID Added --- packages/Webkul/Paypal/src/Payment/SmartButton.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/Webkul/Paypal/src/Payment/SmartButton.php b/packages/Webkul/Paypal/src/Payment/SmartButton.php index 4377b23bf..e485022ca 100644 --- a/packages/Webkul/Paypal/src/Payment/SmartButton.php +++ b/packages/Webkul/Paypal/src/Payment/SmartButton.php @@ -33,6 +33,13 @@ class SmartButton extends Paypal */ protected $code = 'paypal_smart_button'; + /** + * Paypal partner attribution id. + * + * @var string + */ + protected $paypalPartnerAttributionId = 'Bagisto_Cart'; + /** * Constructor. */ @@ -63,6 +70,7 @@ class SmartButton extends Paypal public function createOrder($body) { $request = new OrdersCreateRequest; + $request->headers['PayPal-Partner-Attribution-Id'] = $this->paypalPartnerAttributionId; $request->prefer('return=representation'); $request->body = $body; return $this->client()->execute($request); @@ -77,6 +85,7 @@ class SmartButton extends Paypal public function captureOrder($orderId) { $request = new OrdersCaptureRequest($orderId); + $request->headers['PayPal-Partner-Attribution-Id'] = $this->paypalPartnerAttributionId; $request->prefer('return=representation'); $this->client()->execute($request); } @@ -112,6 +121,7 @@ class SmartButton extends Paypal public function refundOrder($captureId, $body = []) { $request = new CapturesRefundRequest($captureId); + $request->headers['PayPal-Partner-Attribution-Id'] = $this->paypalPartnerAttributionId; $request->body = $body; return $this->client()->execute($request); }