remit 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/remit.rb CHANGED
@@ -19,6 +19,7 @@ require 'remit/ipn_request'
19
19
  require 'remit/get_pipeline'
20
20
  require 'remit/pipeline_response'
21
21
 
22
+ require 'remit/operations/cancel_subscription_and_refund'
22
23
  require 'remit/operations/cancel_token'
23
24
  require 'remit/operations/discard_results'
24
25
  require 'remit/operations/fund_prepaid'
@@ -49,6 +50,7 @@ require 'remit/operations/write_off_debt'
49
50
 
50
51
  module Remit
51
52
  class API < Relax::Service
53
+ include CancelSubscriptionAndRefund
52
54
  include CancelToken
53
55
  include DiscardResults
54
56
  include FundPrepaid
data/lib/remit/common.rb CHANGED
@@ -38,7 +38,7 @@ module Remit
38
38
  end
39
39
  else
40
40
  @status = text_value(element(:Status))
41
- @errors = elements('errors/errors').collect do |error|
41
+ @errors = elements('Errors/Errors').collect do |error|
42
42
  ServiceError.new(error)
43
43
  end unless successful?
44
44
  end
@@ -36,6 +36,14 @@ module Remit
36
36
  parameter :return_url
37
37
  parameter :caller_key
38
38
  parameter :version
39
+ parameter :address_name
40
+ parameter :address_line_1
41
+ parameter :address_line_2
42
+ parameter :city
43
+ parameter :state
44
+ parameter :zip
45
+ parameter :country
46
+ parameter :phone_number
39
47
 
40
48
  def initialize(api, options)
41
49
  @api = api
@@ -53,13 +61,13 @@ module Remit
53
61
  val = self.send(p)
54
62
 
55
63
  # Convert Time values to seconds from Epoch
56
- val = val.to_i if val.class == Time
64
+ val = val.to_i if val.is_a?(Time)
57
65
 
58
66
  query[self.class.convert_key(p.to_s)] = val
59
67
  end
60
68
 
61
69
  # Remove any unused optional parameters
62
- query.reject! { |key, value| value.nil? }
70
+ query.reject! { |key, value| value.nil? || (value.is_a?(String) && value.empty?) }
63
71
 
64
72
  uri.query = SignedQuery.new(@api.pipeline_url, @api.secret_key, query).to_s
65
73
  uri.to_s
@@ -0,0 +1,22 @@
1
+ require 'remit/common'
2
+
3
+ # This operation is used by Amazon Simple Pay.
4
+ module Remit
5
+ module CancelSubscriptionAndRefund
6
+ class Request < Remit::Request
7
+ action :CancelSubscriptionAndRefund
8
+ parameter :caller_reference, :required => true
9
+ parameter :cancel_reason
10
+ parameter :refund_amount, :type => Remit::RequestTypes::Amount
11
+ parameter :subscription_id, :required => true
12
+ end
13
+
14
+ class Response < Remit::Response
15
+ parameter :refund_transaction_id
16
+ end
17
+
18
+ def cancel_subscription_and_refund(request = Request.new)
19
+ call(request, Response)
20
+ end
21
+ end
22
+ end
@@ -26,7 +26,8 @@ module Remit
26
26
  end
27
27
 
28
28
  class Response < Remit::Response
29
- parameter :transaction_response, :type => TransactionResponse
29
+ parser :rexml
30
+ parameter :transaction_response, :namespace => 'ns3', :type => TransactionResponse
30
31
  end
31
32
 
32
33
  def refund(request = Request.new)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Hunt
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-27 00:00:00 -04:00
12
+ date: 2010-01-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -38,6 +38,7 @@ files:
38
38
  - lib/remit/error_codes.rb
39
39
  - lib/remit/get_pipeline.rb
40
40
  - lib/remit/ipn_request.rb
41
+ - lib/remit/operations/cancel_subscription_and_refund.rb
41
42
  - lib/remit/operations/cancel_token.rb
42
43
  - lib/remit/operations/discard_results.rb
43
44
  - lib/remit/operations/fund_prepaid.rb
@@ -70,6 +71,8 @@ files:
70
71
  - README.markdown
71
72
  has_rdoc: true
72
73
  homepage: http://github.com/tylerhunt/remit
74
+ licenses: []
75
+
73
76
  post_install_message:
74
77
  rdoc_options:
75
78
  - --charset=UTF-8
@@ -90,9 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  requirements: []
91
94
 
92
95
  rubyforge_project: remit
93
- rubygems_version: 1.3.1
96
+ rubygems_version: 1.3.5
94
97
  signing_key:
95
- specification_version: 2
98
+ specification_version: 3
96
99
  summary: An API for using the Amazon Flexible Payment Service (FPS).
97
100
  test_files:
98
101
  - spec/integrations/get_account_activity_spec.rb