Module: AmazonFlexPay

Extended by:
API, Pipelines, Util
Defined in:
lib/amazon_flex_pay.rb,
lib/amazon_flex_pay/api.rb,
lib/amazon_flex_pay/util.rb,
lib/amazon_flex_pay/model.rb,
lib/amazon_flex_pay/version.rb,
lib/amazon_flex_pay/pipelines.rb,
lib/amazon_flex_pay/signature.rb

Defined Under Namespace

Modules: API, DataTypes, Enumerations, Pipelines, Util Classes: Model, Signature

Constant Summary collapse

API_VERSION =
'2011-09-20'
PIPELINE_VERSION =
'2009-01-09'
ENDPOINTS =
{
  :sandbox => {
    :api => 'https://fps.sandbox.amazonaws.com/',
    :cbui => 'https://authorize.payments-sandbox.amazon.com/cobranded-ui/actions/start'
  }.freeze,
  :live => {
    :api => 'https://fps.amazonaws.com/',
    :cbui => 'https://authorize.payments.amazon.com/cobranded-ui/actions/start'
  }.freeze
}
VERSION =
'0.11.0'

Constants included from Util

Util::UNSAFE

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Util

escape, query_string

Methods included from API

cancel, cancel_token, get_account_activity, get_account_balance, get_recipient_verification_status, get_token_by_caller_reference, get_token_by_id, get_token_usage, get_tokens, get_transaction, get_transaction_status, pay, refund, reserve, settle, verify_request, verify_signature

Methods included from Pipelines

edit_token_pipeline, multi_use_pipeline, recipient_pipeline, single_use_pipeline

Class Attribute Details

.access_keyObject

Returns the value of attribute access_key.



41
42
43
# File 'lib/amazon_flex_pay.rb', line 41

def access_key
  @access_key
end

.api_endpointObject

The URL used for API calls.

Defaults to the sandbox unless you set it explicitly or call go_live!.



47
48
49
# File 'lib/amazon_flex_pay.rb', line 47

def api_endpoint
  @api_endpoint ||= ENDPOINTS[:sandbox][:api]
end

.pipeline_endpointObject

The URL used for pipeline redirects.

Defaults to the sandbox unless you set it explicitly or call go_live!.



55
56
57
# File 'lib/amazon_flex_pay.rb', line 55

def pipeline_endpoint
  @pipeline_endpoint ||= ENDPOINTS[:sandbox][:cbui]
end

.secret_keyObject

Returns the value of attribute secret_key.



42
43
44
# File 'lib/amazon_flex_pay.rb', line 42

def secret_key
  @secret_key
end

Class Method Details

.go_live!Object

By default all API calls and pipeline redirects are in the Amazon Payments sandbox.

Call AmazonFlexPay.go_live! to enable live transactions and real money in this environment.



63
64
65
66
# File 'lib/amazon_flex_pay.rb', line 63

def go_live!
  self.api_endpoint = ENDPOINTS[:live][:api]
  self.pipeline_endpoint = ENDPOINTS[:live][:cbui]
end

.sign(endpoint, params) ⇒ Object



68
69
70
# File 'lib/amazon_flex_pay.rb', line 68

def sign(endpoint, params)
  Signature.new(secret_key, endpoint, params).generate
end