Skip to content

Commit

Permalink
Merge a4254bf into cbceb30
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladelis committed Jun 7, 2021
2 parents cbceb30 + a4254bf commit 39c6985
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Traits/PayPalHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ protected function setHttpClientConfiguration()
private function makeHttpRequest()
{
try {
return $this->client->post($this->apiUrl, [
$options = [
$this->httpBodyParam => $this->post->toArray(),
])->getBody();
];

if ($this->fraudnetId) {
$options['headers'] = [
'PAYPAL-CLIENT-METADATA-ID' => $this->fraudnetId,
];
}

return $this->client->post($this->apiUrl, $options)->getBody();
} catch (Throwable $t) {
throw new RuntimeException($t->getRequest().' '.$t->getResponse());
}
Expand Down
20 changes: 20 additions & 0 deletions src/Traits/PayPalRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ trait PayPalRequest
*/
private $validateSSL;

/**
* Fraudnet Header Id.
*
* @var string
*/
private $fraudnetId;

/**
* Set PayPal API Credentials.
*
Expand Down Expand Up @@ -230,6 +237,19 @@ public function verifyIPN($post)
return $this->doPayPalRequest('verifyipn');
}

/**
* Function to set fraudnet id.
*
* @param string $fraudnetId
*
* @return $this
*/
public function setFraudnetId($fraudnetId)
{
$this->fraudnetId = $fraudnetId;
return $this;
}

/**
* Setup request data to be sent to PayPal.
*
Expand Down

0 comments on commit 39c6985

Please sign in to comment.