Add getToken() function to Payment class by getting the EC token from the Approval URL

This commit is contained in:
Xiaolei Wheelock
2017-05-02 15:19:41 -05:00
parent ea0897544c
commit 1d1f1d46ad
2 changed files with 15 additions and 1 deletions

View File

@@ -553,7 +553,7 @@ class Payment extends PayPalResourceModel
public function getToken()
{
$parameter_name = "token";
parse_str(parse_url($this->getApprovalLink())['query'], $query);
parse_str(parse_url($this->getApprovalLink(), PHP_URL_QUERY), $query);
return (!isset($query[$parameter_name]) || is_null($query[$parameter_name])) ? null : $query[$parameter_name];
}