/**
  * Build an instance of PayPalRestApiClient\Model\AccessToken given an array
  *
  * @param array $data The array should contains the following keys: 
  * scope, access_token, token_type, app_id, expires_in.
  * The "access_token" key value should not be empty
  * 
  * @return PayPalRestApiClient\Model\AccessToken
  *
  * @throws PayPalRestApiClient\Exception\BuilderException If not all keys are set or when "access_token" is empty
  * 
  * @see https://developer.paypal.com/docs/api/#authentication--headers
  */
 public function build(array $data)
 {
     $this->validateArrayKeys(array('scope', 'access_token', 'token_type', 'app_id', 'expires_in'), $data);
     if (empty($data['access_token'])) {
         throw new BuilderException('access_token is mandatory and should not be empty');
     }
     $accessToken = new AccessToken($data['access_token'], $data['token_type'], $data['app_id'], $data['expires_in'], $data['scope']);
     $accessToken->setPaypalData($data);
     return $accessToken;
 }
 protected function buildRequest(AccessToken $accessToken, $requestBody)
 {
     $request = $this->client->createRequest('POST', $this->baseUrl . '/v1/payments/payment', array('Accept' => 'application/json', 'Accept-Language' => 'en_US', 'Authorization' => $accessToken->getTokenType() . ' ' . $accessToken->getAccessToken(), 'Content-Type' => 'application/json'), $requestBody, array('debug' => $this->debug));
     return $request;
 }