Skip to content

Commit

Permalink
refactored SetExpressCheckout API call
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Jun 28, 2016
1 parent b1797ad commit b072c5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
5 changes: 5 additions & 0 deletions src/Services/ExpressCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public function setExpressCheckout($data, $subscription = false)

$response = $this->doPayPalRequest('SetExpressCheckout', $post);

if (!empty($response['TOKEN'])) {
$response['paypal_link'] = $this->config['gateway_url'] .
'/webscr?cmd=_express-checkout&token=' . $response['TOKEN'];
}

return $response;
}

Expand Down
12 changes: 0 additions & 12 deletions src/Traits/PayPalRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,6 @@ private function doPayPalRequest($method, $params)
$response = $request->getBody(true);
$response = $this->retrieveData($response);

if ($method == 'SetExpressCheckout') {
if (!empty($response['TOKEN'])) {
$response['paypal_link'] = $this->config['gateway_url'] .
'/webscr?cmd=_express-checkout&token=' . $response['TOKEN'];
} else {
return [
'type' => 'error',
'message' => trans('paypal::error.paypal_connection_error')
];
}
}

return $response;

} catch (ClientException $e) {
Expand Down

0 comments on commit b072c5d

Please sign in to comment.