Skip to content

Commit

Permalink
Merge eae534e into 403f2ca
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Feb 10, 2020
2 parents 403f2ca + eae534e commit 16c609d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 32 deletions.
6 changes: 4 additions & 2 deletions src/PayPalFacadeAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class PayPalFacadeAccessor
/**
* Get specific PayPal API provider object to use.
*
* @return ExpressCheckout|AdaptivePayments
* @throws Exception
*
* @return ExpressCheckout|AdaptivePayments
*/
public static function getProvider()
{
Expand All @@ -35,8 +36,9 @@ public static function getProvider()
*
* @param string $option Defaults to express_checkout
*
* @return ExpressCheckout|AdaptivePayments
* @throws Exception
*
* @return ExpressCheckout|AdaptivePayments
*/
public static function setProvider($option = 'express_checkout')
{
Expand Down
7 changes: 4 additions & 3 deletions src/Services/AdaptivePayments.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ public function getPaymentDetails($payKey)
public function getRedirectUrl($option, $payKey)
{
if ($option === 'approved') {
return $this->config['gateway_url'] . '?cmd=' . '_ap-payment&paykey='.$payKey;
return $this->config['gateway_url'].'?cmd='.'_ap-payment&paykey='.$payKey;
}

if ($option === 'pre-approved') {
return $this->config['gateway_url'] . '?cmd=' . '_ap-preapproval&preapprovalkey='.$payKey;
return $this->config['gateway_url'].'?cmd='.'_ap-preapproval&preapprovalkey='.$payKey;
}

return $this->config['gateway_url'] . '?cmd=';
return $this->config['gateway_url'].'?cmd=';
}

/**
Expand Down Expand Up @@ -252,6 +252,7 @@ private function makeHttpRequest()
* Function To Perform PayPal API Request.
*
* @param $method
*
* @return array|mixed
*/
private function doPayPalRequest($method)
Expand Down
64 changes: 40 additions & 24 deletions src/Services/ExpressCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
class ExpressCheckout
{
// Integrate PayPal Request trait
use PayPalAPIRequest, PayPalTransactions, RecurringProfiles;

use PayPalAPIRequest;
use PayPalTransactions;
use RecurringProfiles;
/**
* ExpressCheckout constructor.
*
Expand Down Expand Up @@ -170,8 +171,9 @@ protected function setShippingDiscount($data)
* @param array $data
* @param bool $subscription
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function setExpressCheckout($data, $subscription = false)
{
Expand Down Expand Up @@ -212,8 +214,9 @@ public function setExpressCheckout($data, $subscription = false)
*
* @param string $token
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function getExpressCheckoutDetails($token)
{
Expand All @@ -227,12 +230,13 @@ public function getExpressCheckoutDetails($token)
/**
* Perform DoExpressCheckoutPayment API call on PayPal.
*
* @param array $data
* @param array $data
* @param string $token
* @param string $payerId
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function doExpressCheckoutPayment($data, $token, $payerId)
{
Expand Down Expand Up @@ -261,11 +265,12 @@ public function doExpressCheckoutPayment($data, $token, $payerId)
* Perform a DoAuthorization API call on PayPal.
*
* @param string $authorizationId Transaction ID
* @param float $amount Amount to capture
* @param array $data Optional request fields
* @param float $amount Amount to capture
* @param array $data Optional request fields
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function doAuthorization($authorizationId, $amount, $data = [])
{
Expand All @@ -283,12 +288,13 @@ public function doAuthorization($authorizationId, $amount, $data = [])
* Perform a DoCapture API call on PayPal.
*
* @param string $authorizationId Transaction ID
* @param float $amount Amount to capture
* @param string $complete Indicates whether or not this is the last capture.
* @param array $data Optional request fields
* @param float $amount Amount to capture
* @param string $complete Indicates whether or not this is the last capture.
* @param array $data Optional request fields
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function doCapture($authorizationId, $amount, $complete = 'Complete', $data = [])
{
Expand All @@ -311,8 +317,9 @@ public function doCapture($authorizationId, $amount, $complete = 'Complete', $da
* @param float $amount
* @param array $data
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function doReAuthorization($authorizationId, $amount, $data = [])
{
Expand All @@ -330,10 +337,11 @@ public function doReAuthorization($authorizationId, $amount, $data = [])
* Perform a DoVoid API call on PayPal.
*
* @param string $authorizationId Transaction ID
* @param array $data Optional request fields
* @param array $data Optional request fields
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function doVoid($authorizationId, $data = [])
{
Expand All @@ -351,8 +359,9 @@ public function doVoid($authorizationId, $data = [])
*
* @param string $token
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function createBillingAgreement($token)
{
Expand All @@ -369,8 +378,9 @@ public function createBillingAgreement($token)
* @param array $data
* @param string $token
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function createRecurringPaymentsProfile($data, $token)
{
Expand All @@ -386,8 +396,9 @@ public function createRecurringPaymentsProfile($data, $token)
*
* @param string $id
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function getRecurringPaymentsProfileDetails($id)
{
Expand All @@ -404,8 +415,9 @@ public function getRecurringPaymentsProfileDetails($id)
* @param array $data
* @param string $id
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function updateRecurringPaymentsProfile($data, $id)
{
Expand All @@ -422,8 +434,9 @@ public function updateRecurringPaymentsProfile($data, $id)
* @param string $id
* @param string $status
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
protected function manageRecurringPaymentsProfileStatus($id, $status)
{
Expand All @@ -440,8 +453,9 @@ protected function manageRecurringPaymentsProfileStatus($id, $status)
*
* @param string $id
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function cancelRecurringPaymentsProfile($id)
{
Expand All @@ -453,8 +467,9 @@ public function cancelRecurringPaymentsProfile($id)
*
* @param string $id
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function suspendRecurringPaymentsProfile($id)
{
Expand All @@ -466,8 +481,9 @@ public function suspendRecurringPaymentsProfile($id)
*
* @param string $id
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
public function reactivateRecurringPaymentsProfile($id)
{
Expand Down
5 changes: 3 additions & 2 deletions src/Traits/PayPalHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private function makeHttpRequest()
$this->httpBodyParam => $this->post->toArray(),
])->getBody();
} catch (Throwable $t) {
throw new RuntimeException($t->getRequest() . ' ' . $t->getResponse());
throw new RuntimeException($t->getRequest().' '.$t->getResponse());
}
}

Expand All @@ -100,8 +100,9 @@ private function makeHttpRequest()
*
* @param string $method
*
* @return array|StreamInterface
* @throws Exception
*
* @return array|StreamInterface
*/
private function doPayPalRequest($method)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Traits/PayPalRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ public function setBillingType($billingType = 'MerchantInitiatedBilling')
*
* @param array $post
*
* @return array
* @throws Exception
*
* @return array
*/
public function verifyIPN($post)
{
Expand Down

0 comments on commit 16c609d

Please sign in to comment.