Skip to content

Commit

Permalink
Apply fixes from StyleCI (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive authored Jun 20, 2018
1 parent 45970bc commit 7e6caa3
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions src/Services/ExpressCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ protected function setCartItems($items)
{
return (new Collection($items))->map(function ($item, $num) {
return [
'L_PAYMENTREQUEST_0_NAME' . $num => $item['name'],
'L_PAYMENTREQUEST_0_AMT' . $num => $item['price'],
'L_PAYMENTREQUEST_0_QTY' . $num => isset($item['qty']) ? $item['qty'] : 1,
'L_PAYMENTREQUEST_0_NAME'.$num => $item['name'],
'L_PAYMENTREQUEST_0_AMT'.$num => $item['price'],
'L_PAYMENTREQUEST_0_QTY'.$num => isset($item['qty']) ? $item['qty'] : 1,
];
})->flatMap(function ($value) {
return $value;
Expand All @@ -81,7 +81,7 @@ protected function setCartItems($items)
* Set Recurring payments details for SetExpressCheckout API call.
*
* @param array $data
* @param bool $subscription
* @param bool $subscription
*/
protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false)
{
Expand All @@ -95,7 +95,7 @@ protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription
// Send L_BILLINGTYPE0 and L_BILLINGAGREEMENTDESCRIPTION0 only if there is billing type
if (isset($billingType)) {
$this->post = $this->post->merge([
'L_BILLINGTYPE0' => $billingType,
'L_BILLINGTYPE0' => $billingType,
'L_BILLINGAGREEMENTDESCRIPTION0' => !empty($data['subscription_desc']) ?
$data['subscription_desc'] : $data['invoice_description'],
]);
Expand Down Expand Up @@ -140,7 +140,7 @@ protected function setShippingDiscount($data)

$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPDISCAMT' => $data['shipping_discount'],
'PAYMENTREQUEST_0_AMT' => round($data['total'] + $data['shipping_discount'], 2)
'PAYMENTREQUEST_0_AMT' => round($data['total'] + $data['shipping_discount'], 2),
]);
}
}
Expand All @@ -149,7 +149,7 @@ protected function setShippingDiscount($data)
* Perform a SetExpressCheckout API call on PayPal.
*
* @param array $data
* @param bool $subscription
* @param bool $subscription
*
* @throws \Exception
*
Expand All @@ -160,16 +160,16 @@ public function setExpressCheckout($data, $subscription = false)
$this->setItemSubTotal($data);

$this->post = $this->setCartItems($data['items'])->merge([
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'PAYMENTREQUEST_0_PAYMENTACTION' => $this->paymentAction,
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->currency,
'PAYMENTREQUEST_0_DESC' => $data['invoice_description'],
'PAYMENTREQUEST_0_INVNUM' => $data['invoice_id'],
'NOSHIPPING' => 1,
'RETURNURL' => $data['return_url'],
'CANCELURL' => $data['cancel_url'],
'LOCALE' => $this->locale,
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->currency,
'PAYMENTREQUEST_0_DESC' => $data['invoice_description'],
'PAYMENTREQUEST_0_INVNUM' => $data['invoice_id'],
'NOSHIPPING' => 1,
'RETURNURL' => $data['return_url'],
'CANCELURL' => $data['cancel_url'],
'LOCALE' => $this->locale,
]);

$this->setShippingAmount($data);
Expand All @@ -181,7 +181,7 @@ public function setExpressCheckout($data, $subscription = false)
$response = $this->doPayPalRequest('SetExpressCheckout');

return collect($response)->merge([
'paypal_link' => !empty($response['TOKEN']) ? $this->config['gateway_url'] . '/webscr?cmd=_express-checkout&token=' . $response['TOKEN'] : null,
'paypal_link' => !empty($response['TOKEN']) ? $this->config['gateway_url'].'/webscr?cmd=_express-checkout&token='.$response['TOKEN'] : null,
])->toArray();
}

Expand All @@ -206,7 +206,7 @@ public function getExpressCheckoutDetails($token)
/**
* Perform DoExpressCheckoutPayment API call on PayPal.
*
* @param array $data
* @param array $data
* @param string $token
* @param string $payerid
*
Expand All @@ -219,15 +219,15 @@ public function doExpressCheckoutPayment($data, $token, $payerid)
$this->setItemSubTotal($data);

$this->post = $this->setCartItems($data['items'])->merge([
'TOKEN' => $token,
'PAYERID' => $payerid,
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'TOKEN' => $token,
'PAYERID' => $payerid,
'PAYMENTREQUEST_0_ITEMAMT' => $this->subtotal,
'PAYMENTREQUEST_0_AMT' => $data['total'],
'PAYMENTREQUEST_0_PAYMENTACTION' => !empty($this->config['payment_action']) ? $this->config['payment_action'] : 'Sale',
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->currency,
'PAYMENTREQUEST_0_DESC' => $data['invoice_description'],
'PAYMENTREQUEST_0_INVNUM' => $data['invoice_id'],
'PAYMENTREQUEST_0_NOTIFYURL' => $this->notifyUrl,
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->currency,
'PAYMENTREQUEST_0_DESC' => $data['invoice_description'],
'PAYMENTREQUEST_0_INVNUM' => $data['invoice_id'],
'PAYMENTREQUEST_0_NOTIFYURL' => $this->notifyUrl,
]);

$this->setShippingAmount($data);
Expand All @@ -239,8 +239,8 @@ public function doExpressCheckoutPayment($data, $token, $payerid)
* Perform a DoAuthorization API call on PayPal.
*
* @param string $authorization_id 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
*
* @throws \Exception
*
Expand All @@ -251,7 +251,7 @@ public function doAuthorization($authorization_id, $amount, $data = [])
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
'AMT' => $amount,
])
);

Expand All @@ -262,9 +262,9 @@ public function doAuthorization($authorization_id, $amount, $data = [])
* Perform a DoCapture API call on PayPal.
*
* @param string $authorization_id 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
*
* @throws \Exception
*
Expand All @@ -275,9 +275,9 @@ public function doCapture($authorization_id, $amount, $complete = 'Complete', $d
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMT' => $amount,
'COMPLETETYPE' => $complete,
'CURRENCYCODE' => $this->currency,
'AMT' => $amount,
'COMPLETETYPE' => $complete,
'CURRENCYCODE' => $this->currency,
])
);

Expand All @@ -288,8 +288,8 @@ public function doCapture($authorization_id, $amount, $complete = 'Complete', $d
* Perform a DoReauthorization API call on PayPal to reauthorize an existing authorization transaction.
*
* @param string $authorization_id
* @param float $amount
* @param array $data
* @param float $amount
* @param array $data
*
* @throws \Exception
*
Expand All @@ -300,7 +300,7 @@ public function doReAuthorization($authorization_id, $amount, $data = [])
$this->setRequestData(
array_merge($data, [
'AUTHORIZATIONID' => $authorization_id,
'AMOUNT' => $amount,
'AMOUNT' => $amount,
])
);

Expand All @@ -311,7 +311,7 @@ public function doReAuthorization($authorization_id, $amount, $data = [])
* Perform a DoVoid API call on PayPal.
*
* @param string $authorization_id Transaction ID
* @param array $data Optional request fields
* @param array $data Optional request fields
*
* @throws \Exception
*
Expand Down Expand Up @@ -349,7 +349,7 @@ public function createBillingAgreement($token)
/**
* Perform a CreateRecurringPaymentsProfile API call on PayPal.
*
* @param array $data
* @param array $data
* @param string $token
*
* @throws \Exception
Expand Down Expand Up @@ -386,7 +386,7 @@ public function getRecurringPaymentsProfileDetails($id)
/**
* Perform a UpdateRecurringPaymentsProfile API call on PayPal.
*
* @param array $data
* @param array $data
* @param string $id
*
* @throws \Exception
Expand Down Expand Up @@ -416,7 +416,7 @@ protected function manageRecurringPaymentsProfileStatus($id, $status)
{
$this->setRequestData([
'PROFILEID' => $id,
'ACTION' => $status,
'ACTION' => $status,
]);

return $this->doPayPalRequest('ManageRecurringPaymentsProfileStatus');
Expand Down

0 comments on commit 7e6caa3

Please sign in to comment.