Class: MastercardCoreSdk::Api::RequestTokenApi

Inherits:
Object
  • Object
show all
Includes:
Client, Core, Exceptions, Tracker
Defined in:
lib/mastercard_core_sdk/api/request_token_api.rb

Overview

Invokes RequestTokenApi.

Class Method Summary collapse

Class Method Details

.create(oauth_callback_url, api_config = nil) ⇒ RequestTokenResponse

This api call used to get the request token.This must be executed when a consumer clicks Buy with MasterPass or Connect with MasterPass buttons on your site/app.

Parameters:

  • oauth_callback_url

    the oauth callback URL.

  • api_config (defaults to: nil)

    Optional ApiConfig object.

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mastercard_core_sdk/api/request_token_api.rb', line 18

def self.create(oauth_callback_url, api_config = nil)
  path = "/oauth/consumer/v1/request_token"

  service_request = ServiceRequest.new
  service_request.headers = {"oauth_callback" => oauth_callback_url}
  service_request.content_type = "application/xml"
  api_client = ApiClient.new(api_config)

  api_client.api_tracker = TokenApiTracker.new
  api_client.error_handler = ErrorHandler.new
  return api_client.call(path, service_request, "POST", RequestTokenResponse)
end