NewMonarch-remit 0.0.1

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.
Files changed (46) hide show
  1. data/LICENSE +20 -0
  2. data/README +79 -0
  3. data/lib/remit.rb +133 -0
  4. data/lib/remit/cancel_token.rb +18 -0
  5. data/lib/remit/common.rb +87 -0
  6. data/lib/remit/data_types.rb +164 -0
  7. data/lib/remit/discard_results.rb +18 -0
  8. data/lib/remit/error_codes.rb +116 -0
  9. data/lib/remit/fund_prepaid.rb +31 -0
  10. data/lib/remit/get_account_activity.rb +60 -0
  11. data/lib/remit/get_account_balance.rb +29 -0
  12. data/lib/remit/get_all_credit_instruments.rb +18 -0
  13. data/lib/remit/get_all_prepaid_instruments.rb +18 -0
  14. data/lib/remit/get_debt_balance.rb +23 -0
  15. data/lib/remit/get_outstanding_debt_balance.rb +22 -0
  16. data/lib/remit/get_payment_instruction.rb +21 -0
  17. data/lib/remit/get_pipeline.rb +181 -0
  18. data/lib/remit/get_prepaid_balance.rb +23 -0
  19. data/lib/remit/get_results.rb +27 -0
  20. data/lib/remit/get_token_by_caller.rb +19 -0
  21. data/lib/remit/get_token_usage.rb +18 -0
  22. data/lib/remit/get_tokens.rb +20 -0
  23. data/lib/remit/get_total_prepaid_liability.rb +22 -0
  24. data/lib/remit/get_transaction.rb +42 -0
  25. data/lib/remit/install_payment_instruction.rb +22 -0
  26. data/lib/remit/ipn_request.rb +56 -0
  27. data/lib/remit/pay.rb +35 -0
  28. data/lib/remit/pipeline_response.rb +62 -0
  29. data/lib/remit/refund.rb +38 -0
  30. data/lib/remit/reserve.rb +30 -0
  31. data/lib/remit/retry_transaction.rb +18 -0
  32. data/lib/remit/settle.rb +20 -0
  33. data/lib/remit/settle_debt.rb +30 -0
  34. data/lib/remit/subscribe_for_caller_notification.rb +18 -0
  35. data/lib/remit/unsubscribe_for_caller_notification.rb +17 -0
  36. data/lib/remit/write_off_debt.rb +28 -0
  37. data/spec/integrations/get_account_activity_spec.rb +36 -0
  38. data/spec/integrations/get_tokens_spec.rb +38 -0
  39. data/spec/integrations/integrations_helper.rb +8 -0
  40. data/spec/spec_helper.rb +40 -0
  41. data/spec/units/get_pipeline_spec.rb +165 -0
  42. data/spec/units/get_results_spec.rb +47 -0
  43. data/spec/units/ipn_request_spec.rb +34 -0
  44. data/spec/units/pay_spec.rb +70 -0
  45. data/spec/units/units_helper.rb +4 -0
  46. metadata +115 -0
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/units_helper'
2
+
3
+ describe 'an IPN request' do
4
+
5
+ before(:each) do
6
+ @request_params = {
7
+ "action" => "notice",
8
+ "buyerName" => "Fps Buyer",
9
+ "callerReference" => "4-8-1-3.5",
10
+ "controller" => "amazon_fps/ipn",
11
+ "operation" => "PAY",
12
+ "paymentMethod" => "CC",
13
+ "recipientEmail" => "recipient@email.url",
14
+ "recipientName" => "Fps Business",
15
+ "signature" => "DA7ZbuQaBDt2/+Mty9XweJyqI1E=",
16
+ "status" => "SUCCESS",
17
+ "transactionAmount" => "USD 3.50",
18
+ "transactionDate" => "1224687134",
19
+ "transactionId" => "13KIGL9RC25853BGPPOS2VSKBKF2JERR3HO"
20
+ }
21
+ @request = Remit::IpnRequest.new(@request_params, 'THISISMYTESTKEY')
22
+ end
23
+
24
+ it 'should be a valid request' do
25
+ @request.should be_valid
26
+ end
27
+
28
+ it 'should pass through access to given parameters' do
29
+ @request.status.should eql('SUCCESS')
30
+ @request.operation.should eql('PAY')
31
+ @request.transactionId.should eql('13KIGL9RC25853BGPPOS2VSKBKF2JERR3HO')
32
+ end
33
+
34
+ end
@@ -0,0 +1,70 @@
1
+ require File.dirname(__FILE__) + '/units_helper'
2
+
3
+ describe "the Pay API" do
4
+ describe "a successful response" do
5
+ it_should_behave_like 'a successful response'
6
+
7
+ before do
8
+ doc = <<-EXML
9
+ <ns3:PayResponse xmlns:ns3="http://fps.amazonaws.com/doc/2007-01-08/">
10
+ <ns3:TransactionResponse>
11
+ <TransactionId>abc123</TransactionId>
12
+ <Status>Initiated</Status>
13
+ </ns3:TransactionResponse>
14
+ <Status>Success</Status>
15
+ <RequestId>foo</RequestId>
16
+ </ns3:PayResponse>
17
+ EXML
18
+
19
+ @response = Remit::Pay::Response.new(doc)
20
+ end
21
+
22
+ it "has a transaction response" do
23
+ @response.transaction_response.should_not be_nil
24
+ end
25
+
26
+ it "has a transaction id" do
27
+ @response.transaction_response.transaction_id.should == 'abc123'
28
+ end
29
+
30
+ it "has a transaction status" do
31
+ @response.transaction_response.status.should == 'Initiated'
32
+ end
33
+
34
+ it "has status shortcuts" do
35
+ @response.transaction_response.should be_initiated
36
+ end
37
+ end
38
+
39
+ describe "for a failed request" do
40
+ it_should_behave_like 'a failed response'
41
+
42
+ before do
43
+ doc = <<-EXML
44
+ <ns3:PayResponse xmlns:ns3=\"http://fps.amazonaws.com/doc/2007-01-08/\">
45
+ <Status>Failure</Status>
46
+ <Errors>
47
+ <Errors>
48
+ <ErrorType>Business</ErrorType>
49
+ <IsRetriable>false</IsRetriable>
50
+ <ErrorCode>InvalidParams</ErrorCode>
51
+ <ReasonText>callerTokenId can not be empty</ReasonText>
52
+ </Errors>
53
+ </Errors>
54
+ <RequestId>7966a2d9-5ce9-4902-aefc-b01d254c931a:0</RequestId>
55
+ </ns3:PayResponse>
56
+ EXML
57
+
58
+ @response = Remit::Pay::Response.new(doc)
59
+ end
60
+
61
+ it "has error details" do
62
+ error = @response.errors.first
63
+ error.should be_kind_of(Remit::ServiceError)
64
+ error.error_type.should == 'Business'
65
+ error.is_retriable.should == 'false'
66
+ error.error_code.should == 'InvalidParams'
67
+ error.reason_text.should == 'callerTokenId can not be empty'
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,4 @@
1
+ ACCESS_KEY = 'foo'
2
+ SECRET_KEY = 'bar'
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: NewMonarch-remit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tyler Hunt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-29 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: relax
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.5
23
+ version:
24
+ description:
25
+ email: tyler@tylerhunt.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README
32
+ - LICENSE
33
+ files:
34
+ - lib/remit
35
+ - lib/remit/cancel_token.rb
36
+ - lib/remit/common.rb
37
+ - lib/remit/data_types.rb
38
+ - lib/remit/discard_results.rb
39
+ - lib/remit/error_codes.rb
40
+ - lib/remit/fund_prepaid.rb
41
+ - lib/remit/get_account_activity.rb
42
+ - lib/remit/get_account_balance.rb
43
+ - lib/remit/get_all_credit_instruments.rb
44
+ - lib/remit/get_all_prepaid_instruments.rb
45
+ - lib/remit/get_debt_balance.rb
46
+ - lib/remit/get_outstanding_debt_balance.rb
47
+ - lib/remit/get_payment_instruction.rb
48
+ - lib/remit/get_pipeline.rb
49
+ - lib/remit/get_prepaid_balance.rb
50
+ - lib/remit/get_results.rb
51
+ - lib/remit/get_token_by_caller.rb
52
+ - lib/remit/get_token_usage.rb
53
+ - lib/remit/get_tokens.rb
54
+ - lib/remit/get_total_prepaid_liability.rb
55
+ - lib/remit/get_transaction.rb
56
+ - lib/remit/install_payment_instruction.rb
57
+ - lib/remit/ipn_request.rb
58
+ - lib/remit/pay.rb
59
+ - lib/remit/pipeline_response.rb
60
+ - lib/remit/refund.rb
61
+ - lib/remit/reserve.rb
62
+ - lib/remit/retry_transaction.rb
63
+ - lib/remit/settle.rb
64
+ - lib/remit/settle_debt.rb
65
+ - lib/remit/subscribe_for_caller_notification.rb
66
+ - lib/remit/unsubscribe_for_caller_notification.rb
67
+ - lib/remit/write_off_debt.rb
68
+ - lib/remit.rb
69
+ - spec/integrations/get_account_activity_spec.rb
70
+ - spec/integrations/get_tokens_spec.rb
71
+ - spec/units/get_pipeline_spec.rb
72
+ - spec/units/get_results_spec.rb
73
+ - spec/units/ipn_request_spec.rb
74
+ - spec/units/pay_spec.rb
75
+ - spec/integrations/integrations_helper.rb
76
+ - spec/spec_helper.rb
77
+ - spec/units/units_helper.rb
78
+ - README
79
+ - LICENSE
80
+ has_rdoc: true
81
+ homepage: http://tylerhunt.com/
82
+ post_install_message:
83
+ rdoc_options: []
84
+
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ requirements: []
100
+
101
+ rubyforge_project: remit
102
+ rubygems_version: 1.2.0
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: An API for using the Amazon Flexible Payment Service (FPS).
106
+ test_files:
107
+ - spec/integrations/get_account_activity_spec.rb
108
+ - spec/integrations/get_tokens_spec.rb
109
+ - spec/units/get_pipeline_spec.rb
110
+ - spec/units/get_results_spec.rb
111
+ - spec/units/ipn_request_spec.rb
112
+ - spec/units/pay_spec.rb
113
+ - spec/integrations/integrations_helper.rb
114
+ - spec/spec_helper.rb
115
+ - spec/units/units_helper.rb