activemerchant 1.0.2 → 1.0.3

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.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
  # ---
3
+ # * Add support for PayPal mass payments to the PaypalGateway and the PaypalExpressGateway [Brandon Keepers]
4
+ #
5
+ # * Add a credit method to Authorize.net [cody]
6
+ #
3
7
  # * Add support for OrderDescription, Payer, and InvoiceID fields in PaypalGateway [cody]
4
8
  #
5
9
  # * Add support for crediting to PayPal [cody, Haig]
@@ -80,6 +80,16 @@ module ActiveMerchant #:nodoc:
80
80
  post = {:trans_id => authorization}
81
81
  commit('VOID', nil, post)
82
82
  end
83
+
84
+ def credit(money, identification, options = {})
85
+ requires!(options, :card_number)
86
+
87
+ post = { :trans_id => identification,
88
+ :card_num => options[:card_number]
89
+ }
90
+
91
+ commit('CREDIT', money, post)
92
+ end
83
93
 
84
94
  # We support visa and master card
85
95
  def self.supported_cardtypes
@@ -38,8 +38,8 @@ module ActiveMerchant #:nodoc:
38
38
  shipping_address = options[:shipping_address] || options[:address]
39
39
 
40
40
  xml = Builder::XmlMarkup.new :indent => 2
41
- xml.tag! 'DoDirectPaymentReq', 'xmlns' => 'urn:ebay:api:PayPalAPI' do
42
- xml.tag! 'DoDirectPaymentRequest', 'xmlns:n2' => 'urn:ebay:apis:eBLBaseComponents' do
41
+ xml.tag! 'DoDirectPaymentReq', 'xmlns' => PAYPAL_NAMESPACE do
42
+ xml.tag! 'DoDirectPaymentRequest', 'xmlns:n2' => EBAY_NAMESPACE do
43
43
  xml.tag! 'n2:Version', '2.0'
44
44
  xml.tag! 'n2:DoDirectPaymentRequestDetails' do
45
45
  xml.tag! 'n2:PaymentAction', action
@@ -45,6 +45,20 @@ module ActiveMerchant #:nodoc:
45
45
  def capture(money, authorization, options = {})
46
46
  commit 'DoCapture', build_capture_request(money, authorization, options)
47
47
  end
48
+
49
+ # Transfer money to one or more recipients.
50
+ #
51
+ # gateway.transfer 1000, 'bob@example.com',
52
+ # :subject => "The money I owe you", :note => "Sorry it's so late"
53
+ #
54
+ # gateway.transfer [1000, 'fred@example.com'],
55
+ # [2450, 'wilma@example.com', :note => 'You will receive another payment on 3/24'],
56
+ # [2000, 'barney@example.com'],
57
+ # :subject => "Your Earnings", :note => "Thanks for your business."
58
+ #
59
+ def transfer(*args)
60
+ commit 'MassPay', build_mass_pay_request(*args)
61
+ end
48
62
 
49
63
  def void(authorization, options = {})
50
64
  commit 'DoVoid', build_void_request(authorization, options)
@@ -102,6 +116,30 @@ module ActiveMerchant #:nodoc:
102
116
  xml.target!
103
117
  end
104
118
 
119
+ def build_mass_pay_request(*args)
120
+ default_options = args.last.is_a?(Hash) ? args.pop : {}
121
+ recipients = args.first.is_a?(Array) ? args : [args]
122
+
123
+ xml = Builder::XmlMarkup.new :indent => 2
124
+
125
+ xml.tag! 'MassPayReq', 'xmlns' => PAYPAL_NAMESPACE do
126
+ xml.tag! 'MassPayRequest', 'xmlns:n2' => EBAY_NAMESPACE do
127
+ xml.tag! 'n2:Version', '2.0'
128
+ xml.tag! 'EmailSubject', default_options[:subject] if default_options[:subject]
129
+ recipients.each do |money, recipient, options|
130
+ options ||= default_options
131
+ xml.tag! 'MassPayItem' do
132
+ xml.tag! 'ReceiverEmail', recipient
133
+ xml.tag! 'Amount', amount(money), 'currencyID' => currency(money)
134
+ xml.tag! 'Note', options[:note] if options[:note]
135
+ end
136
+ end
137
+ end
138
+ end
139
+
140
+ xml.target!
141
+ end
142
+
105
143
  def ssl_post(data)
106
144
  uri = URI.parse(test? ? TEST_URL : LIVE_URL)
107
145
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: activemerchant
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.2
7
- date: 2007-02-22 00:00:00 -05:00
6
+ version: 1.0.3
7
+ date: 2007-02-25 00:00:00 -05:00
8
8
  summary: Framework and tools for dealing with credit card transactions.
9
9
  require_paths:
10
10
  - lib
metadata.gz.sig CHANGED
Binary file