Merge pull request #4792 from devansh-webkul/master

Paypal partner attribution ID added
This commit is contained in:
Jitendra Singh 2021-04-12 13:28:32 +05:30 committed by GitHub
commit 4208f4ef4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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);
}