amazon_flex_pay 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/amazon_flex_pay/api/get_transaction.rb +8 -0
- data/lib/amazon_flex_pay/data_types.rb +14 -0
- data/lib/amazon_flex_pay.rb +2 -2
- data/test/api_test.rb +6 -0
- data/test/data_types_test.rb +30 -0
- metadata +6 -4
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -38,4 +38,4 @@ Note that while the examples are shown using Rails methods, the only Rails requi
|
|
38
38
|
|
39
39
|
All methods required for integrating API calls and Pipeline requests are found in the AmazonFlexPay module.
|
40
40
|
|
41
|
-
Copyright (c)
|
41
|
+
Copyright (c) 2012 Kickstarter, released under the MIT license.
|
@@ -4,6 +4,14 @@ module AmazonFlexPay::API #:nodoc:
|
|
4
4
|
|
5
5
|
class Response < BaseResponse #:nodoc:
|
6
6
|
attribute :transaction, :type => :transaction_detail
|
7
|
+
|
8
|
+
def method_missing(attr)
|
9
|
+
if transaction.respond_to? attr
|
10
|
+
transaction.send attr
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
7
15
|
end
|
8
16
|
end
|
9
17
|
end
|
@@ -48,6 +48,18 @@ module AmazonFlexPay::DataTypes
|
|
48
48
|
class RelatedTransaction < AmazonFlexPay::Model #:nodoc:
|
49
49
|
attribute :relation_type, :enumeration => :relation_type
|
50
50
|
attribute :transaction_id
|
51
|
+
|
52
|
+
AmazonFlexPay::Enumerations::RelationType.each do |relation|
|
53
|
+
class_eval <<-END
|
54
|
+
def #{relation.underscore}?
|
55
|
+
relation_type == '#{relation}'
|
56
|
+
end
|
57
|
+
END
|
58
|
+
end
|
59
|
+
|
60
|
+
def full
|
61
|
+
AmazonFlexPay::API::GetTransaction.new(:transaction_id => transaction_id).submit
|
62
|
+
end
|
51
63
|
end
|
52
64
|
|
53
65
|
class StatusHistory < AmazonFlexPay::Model #:nodoc:
|
@@ -125,6 +137,8 @@ module AmazonFlexPay::DataTypes
|
|
125
137
|
attribute :transaction_amount, :type => :amount
|
126
138
|
attribute :transaction_id
|
127
139
|
attribute :transaction_status, :enumeration => :transaction_status
|
140
|
+
|
141
|
+
alias_method :related_transactions, :related_transaction
|
128
142
|
end
|
129
143
|
|
130
144
|
class TransactionPart < AmazonFlexPay::Model #:nodoc:
|
data/lib/amazon_flex_pay.rb
CHANGED
@@ -10,14 +10,14 @@ require 'active_support/inflector'
|
|
10
10
|
|
11
11
|
require 'amazon_flex_pay/signing'
|
12
12
|
require 'amazon_flex_pay/model'
|
13
|
-
require 'amazon_flex_pay/data_types'
|
14
13
|
require 'amazon_flex_pay/enumerations'
|
14
|
+
require 'amazon_flex_pay/data_types'
|
15
15
|
|
16
16
|
require 'amazon_flex_pay/api'
|
17
17
|
require 'amazon_flex_pay/pipelines'
|
18
18
|
|
19
19
|
module AmazonFlexPay
|
20
|
-
VERSION = '0.9.
|
20
|
+
VERSION = '0.9.8'
|
21
21
|
API_VERSION = '2011-09-20'
|
22
22
|
PIPELINE_VERSION = '2009-01-09'
|
23
23
|
|
data/test/api_test.rb
CHANGED
@@ -176,6 +176,12 @@ class AmazonFlexPayTest < AmazonFlexPay::Test
|
|
176
176
|
assert response.transaction.payment_method
|
177
177
|
end
|
178
178
|
|
179
|
+
should "delegate to transaction attributes" do
|
180
|
+
response = AmazonFlexPay::API::GetTransaction::Response.from_xml(get_transaction_response)
|
181
|
+
assert_equal response.caller_reference, response.transaction.caller_reference
|
182
|
+
assert_equal response.date_completed, response.transaction.date_completed
|
183
|
+
end
|
184
|
+
|
179
185
|
## GetTransactionStatus
|
180
186
|
|
181
187
|
should "construct a GetTransactionStatus request" do
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class AmazonFlexPayTest < AmazonFlexPay::Test
|
4
|
+
include AmazonFlexPay::DataTypes
|
5
|
+
include ResponseSamples
|
6
|
+
|
7
|
+
should "alias TransactionDetail#related_transaction" do
|
8
|
+
detail = TransactionDetail.new(:related_transaction => [{:relation_type => 'Refund', :transaction_id => 'abc123'}])
|
9
|
+
assert detail.respond_to?(:related_transactions)
|
10
|
+
assert_equal detail.related_transactions, detail.related_transaction
|
11
|
+
end
|
12
|
+
|
13
|
+
should "support RelatedTransaction relation type query methods" do
|
14
|
+
related = RelatedTransaction.new(:relation_type => 'MarketplaceFee', :transaction_id => 'abc123')
|
15
|
+
assert related.respond_to?(:marketplace_fee?)
|
16
|
+
assert related.marketplace_fee?
|
17
|
+
assert !related.refund?
|
18
|
+
end
|
19
|
+
|
20
|
+
should "support RelatedTransaction expansion" do
|
21
|
+
related = RelatedTransaction.new(:relation_type => 'Refund', :transaction_id => 'abc123')
|
22
|
+
AmazonFlexPay::API::GetTransaction.any_instance.expects(:submit).returns(
|
23
|
+
AmazonFlexPay::API::GetTransaction::Response.new(
|
24
|
+
:transaction => {:transaction_id => 'abc123'}
|
25
|
+
)
|
26
|
+
)
|
27
|
+
|
28
|
+
assert_equal 'abc123', related.full.transaction_id
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_flex_pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lance Ivy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-03-02 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- Rakefile
|
123
123
|
- test/amazon_flex_pay_test.rb
|
124
124
|
- test/api_test.rb
|
125
|
+
- test/data_types_test.rb
|
125
126
|
- test/pipelines_test.rb
|
126
127
|
- test/response_samples.rb
|
127
128
|
- test/test_helper.rb
|
@@ -162,6 +163,7 @@ summary: API layer for Amazon FPS
|
|
162
163
|
test_files:
|
163
164
|
- test/amazon_flex_pay_test.rb
|
164
165
|
- test/api_test.rb
|
166
|
+
- test/data_types_test.rb
|
165
167
|
- test/pipelines_test.rb
|
166
168
|
- test/response_samples.rb
|
167
169
|
- test/test_helper.rb
|