activemerchant 1.42.2 → 1.42.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.
Files changed (59) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG +32 -0
  5. data/CONTRIBUTORS +12 -0
  6. data/README.md +3 -0
  7. data/lib/active_merchant/billing/base.rb +9 -2
  8. data/lib/active_merchant/billing/credit_card_methods.rb +1 -1
  9. data/lib/active_merchant/billing/gateway.rb +1 -1
  10. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  11. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +8 -8
  12. data/lib/active_merchant/billing/gateways/balanced.rb +7 -2
  13. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/bogus.rb +32 -22
  15. data/lib/active_merchant/billing/gateways/braintree_blue.rb +124 -39
  16. data/lib/active_merchant/billing/gateways/cyber_source.rb +2 -2
  17. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +2 -2
  19. data/lib/active_merchant/billing/gateways/moneris.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -1
  21. data/lib/active_merchant/billing/gateways/nab_transact.rb +3 -1
  22. data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
  23. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  24. data/lib/active_merchant/billing/gateways/payex.rb +402 -0
  25. data/lib/active_merchant/billing/gateways/payflow.rb +41 -11
  26. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/paymill.rb +55 -3
  28. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/payscout.rb +171 -0
  30. data/lib/active_merchant/billing/gateways/pin.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/redsys.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
  34. data/lib/active_merchant/billing/gateways/stripe.rb +23 -25
  35. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +26 -15
  36. data/lib/active_merchant/billing/gateways/webpay.rb +27 -11
  37. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -1
  38. data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +1 -1
  39. data/lib/active_merchant/billing/integrations/ipay88.rb +4 -0
  40. data/lib/active_merchant/billing/integrations/ipay88/helper.rb +1 -1
  41. data/lib/active_merchant/billing/integrations/ipay88/notification.rb +103 -0
  42. data/lib/active_merchant/billing/integrations/ipay88/return.rb +8 -74
  43. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +1 -1
  44. data/lib/active_merchant/billing/integrations/paypal/helper.rb +1 -1
  45. data/lib/active_merchant/billing/integrations/payu_in.rb +2 -9
  46. data/lib/active_merchant/billing/integrations/payu_in/helper.rb +15 -13
  47. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +9 -20
  48. data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +1 -1
  49. data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -10
  50. data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +1 -1
  51. data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +1 -1
  52. data/lib/active_merchant/billing/integrations/valitor/helper.rb +3 -3
  53. data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +2 -2
  54. data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +1 -1
  55. data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +1 -1
  56. data/lib/active_merchant/billing/integrations/world_pay/helper.rb +2 -2
  57. data/lib/active_merchant/version.rb +1 -1
  58. metadata +7 -3
  59. metadata.gz.sig +0 -0
@@ -5,88 +5,22 @@ module ActiveMerchant #:nodoc:
5
5
  module Integrations #:nodoc:
6
6
  module Ipay88
7
7
  class Return < ActiveMerchant::Billing::Integrations::Return
8
- include ActiveMerchant::PostsData
9
8
 
10
- def account
11
- params["MerchantCode"]
12
- end
13
-
14
- def payment
15
- params["PaymentId"].to_i
16
- end
17
-
18
- def order
19
- params["RefNo"]
20
- end
21
-
22
- def amount
23
- params["Amount"]
24
- end
25
-
26
- def currency
27
- params["Currency"]
28
- end
29
-
30
- def remark
31
- params["Remark"]
32
- end
33
-
34
- def transaction
35
- params["TransId"]
36
- end
37
-
38
- def auth_code
39
- params["AuthCode"]
40
- end
41
-
42
- def status
43
- params["Status"]
44
- end
45
-
46
- def error
47
- params["ErrDesc"]
48
- end
49
-
50
- def signature
51
- params["Signature"]
52
- end
53
-
54
- def secure?
55
- self.generated_signature == self.signature
9
+ def initialize(query_string, options = {})
10
+ super
11
+ @notification = Notification.new(query_string, options)
56
12
  end
57
13
 
58
14
  def success?
59
- self.secure? && self.requery == "00" && self.status == "1"
60
- end
61
-
62
- protected
63
-
64
- def generated_signature
65
- Helper.sign(self.sig_components)
66
- end
67
-
68
- def sig_components
69
- components = [@options[:credential2]]
70
- [:account, :payment, :order, :amount_in_cents, :currency, :status].each do |i|
71
- components << self.send(i)
72
- end
73
- components.join
15
+ params["Status"] == "1"
74
16
  end
75
17
 
76
- def requery
77
- data = { "MerchantCode" => self.account, "RefNo" => self.order, "Amount" => self.amount }
78
- params = parameterize(data)
79
- ssl_post Ipay88.service_url, params, { "Content-Length" => params.size.to_s, "User-Agent" => "Active Merchant -- http://activemerchant.org" }
18
+ def cancelled?
19
+ params["ErrDesc"] == 'Customer Cancel Transaction'
80
20
  end
81
21
 
82
- private
83
-
84
- def parameterize(params)
85
- params.reject { |k, v| v.blank? }.keys.sort.collect { |key| "#{key}=#{CGI.escape(params[key].to_s)}" }.join("&")
86
- end
87
-
88
- def amount_in_cents
89
- @amount_in_cents ||= (self.amount || "").gsub(/[.,]/, "")
22
+ def message
23
+ params["ErrDesc"]
90
24
  end
91
25
  end
92
26
  end
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  params['amount_gross']
74
74
  end
75
75
 
76
- # The total in fees which was deducated from the amount.
76
+ # The total in fees which was deducted from the amount.
77
77
  def fee
78
78
  params['amount_fee']
79
79
  end
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  if params.has_key?(:phone)
70
70
  phone = params.delete(:phone).to_s
71
71
 
72
- # Whipe all non digits
72
+ # Wipe all non digits
73
73
  phone.gsub!(/\D+/, '')
74
74
 
75
75
  if ['US', 'CA'].include?(country_code) && phone =~ /(\d{3})(\d{3})(\d{4})$/
@@ -27,15 +27,8 @@ module ActiveMerchant #:nodoc:
27
27
  Return.new(post, options)
28
28
  end
29
29
 
30
- def self.checksum(merchant_id, secret_key, *payload_items )
31
- options = payload_items.pop if Hash === payload_items.last
32
- options ||= {}
33
- payload = if options[:reverse] then
34
- payload_items.dup.push( merchant_id || "" ).unshift( secret_key || "" ).collect{ |x| x.to_s }.join("|")
35
- else
36
- payload_items.dup.unshift( merchant_id || "" ).push( secret_key || "" ).collect{ |x| x.to_s }.join("|")
37
- end
38
- Digest::SHA512.hexdigest( payload )
30
+ def self.checksum(merchant_id, secret_key, payload_items )
31
+ Digest::SHA512.hexdigest([merchant_id, *payload_items, secret_key].join("|"))
39
32
  end
40
33
  end
41
34
  end
@@ -4,10 +4,13 @@ module ActiveMerchant #:nodoc:
4
4
  module PayuIn
5
5
  class Helper < ActiveMerchant::Billing::Integrations::Helper
6
6
 
7
+ CHECKSUM_FIELDS = [ 'txnid', 'amount', 'productinfo', 'firstname', 'email', 'udf1', 'udf2', 'udf3', 'udf4',
8
+ 'udf5', 'udf6', 'udf7', 'udf8', 'udf9', 'udf10']
9
+
7
10
  mapping :amount, 'amount'
8
11
  mapping :account, 'key'
9
12
  mapping :order, 'txnid'
10
- mapping :credential2, 'productinfo'
13
+ mapping :description, 'productinfo'
11
14
 
12
15
  mapping :customer, :first_name => 'firstname',
13
16
  :last_name => 'lastname',
@@ -44,26 +47,25 @@ module ActiveMerchant #:nodoc:
44
47
 
45
48
  def initialize(order, account, options = {})
46
49
  super
50
+ @options = options
47
51
  self.pg = 'CC'
48
52
  end
49
53
 
50
54
  def form_fields
55
+ sanitize_fields
51
56
  @fields.merge(mappings[:checksum] => generate_checksum)
52
57
  end
53
58
 
54
- def generate_checksum( options = {} )
55
- checksum_fields = [ :order, :amount, :credential2, { :customer => [ :first_name, :email ] },
56
- { :user_defined => [ :var1, :var2, :var3, :var4, :var5, :var6, :var7, :var8, :var9, :var10 ] } ]
57
- checksum_payload_items = checksum_fields.inject( [] ) do | items, field |
58
- if Hash === field then
59
- key = field.keys.first
60
- field[key].inject( items ){ |s,x| items.push( @fields[ mappings[key][x] ] ) }
61
- else
62
- items.push( @fields[ mappings[field] ] )
63
- end
59
+ def generate_checksum
60
+ checksum_payload_items = CHECKSUM_FIELDS.map { |field| @fields[field] }
61
+
62
+ PayuIn.checksum(@fields["key"], @options[:credential2], checksum_payload_items )
63
+ end
64
+
65
+ def sanitize_fields
66
+ ['address1', 'address2', 'city', 'state', 'country', 'productinfo', 'email', 'phone'].each do |field|
67
+ @fields[field].gsub!(/[^a-zA-Z0-9\-_@\/\s.]/, '') if @fields[field]
64
68
  end
65
- checksum_payload_items.push( options )
66
- PayuIn.checksum(@fields["key"], @fields["productinfo"], *checksum_payload_items )
67
69
  end
68
70
 
69
71
  end
@@ -15,18 +15,10 @@ module ActiveMerchant #:nodoc:
15
15
  end
16
16
 
17
17
  def status
18
- @status ||= if checksum_ok?
19
- if transaction_id.blank?
20
- 'Invalid'
21
- else
22
- case transaction_status.downcase
23
- when 'success' then 'Completed'
24
- when 'failure' then 'Failed'
25
- when 'pending' then 'Pending'
26
- end
27
- end
28
- else
29
- 'Tampered'
18
+ case transaction_status.downcase
19
+ when 'success' then 'Completed'
20
+ when 'failure' then 'Failed'
21
+ when 'pending' then 'Pending'
30
22
  end
31
23
  end
32
24
 
@@ -36,7 +28,7 @@ module ActiveMerchant #:nodoc:
36
28
 
37
29
  # Order amount should be equal to gross - discount
38
30
  def amount_ok?( order_amount, order_discount = BigDecimal.new( '0.0' ) )
39
- BigDecimal.new( gross ) == order_amount && BigDecimal.new( discount ) == order_discount
31
+ BigDecimal.new( gross ) == order_amount && BigDecimal.new( discount.to_s ) == order_discount
40
32
  end
41
33
 
42
34
  # Status of transaction return from the PayU. List of possible values:
@@ -129,10 +121,7 @@ module ActiveMerchant #:nodoc:
129
121
  end
130
122
 
131
123
  def user_defined
132
- return @user_defined if @user_defined
133
- @user_defined = []
134
- 10.times{ |i| @user_defined.push( params[ "udf#{i+1}" ] ) }
135
- @user_defined
124
+ @user_defined ||= 10.times.map { |i| params["udf#{i + 1}"] }
136
125
  end
137
126
 
138
127
  def checksum
@@ -148,9 +137,9 @@ module ActiveMerchant #:nodoc:
148
137
  end
149
138
 
150
139
  def checksum_ok?
151
- fields = user_defined.dup.push( customer_email, customer_first_name, product_info, gross, invoice, :reverse => true )
152
- fields.unshift( transaction_status )
153
- unless PayuIn.checksum(@merchant_id, @secret_key, *fields ) == checksum
140
+ checksum_fields = [transaction_status, *user_defined.reverse, customer_email, customer_first_name, product_info, gross, invoice]
141
+
142
+ unless Digest::SHA512.hexdigest([@secret_key, *checksum_fields, @merchant_id].join("|")) == checksum
154
143
  @message = 'Return checksum not matching the data provided'
155
144
  return false
156
145
  end
@@ -7,7 +7,7 @@ module ActiveMerchant
7
7
  mapping :service_provider, 'service_provider'
8
8
 
9
9
  def initialize(order, account, options = {})
10
- super order, account, options
10
+ super
11
11
  self.service_provider = 'payu_paisa'
12
12
  self.user_defined = { :var2 => order }
13
13
  end
@@ -6,16 +6,6 @@ module ActiveMerchant
6
6
  def item_id
7
7
  params['udf2']
8
8
  end
9
-
10
- def checksum_ok?
11
- fields = user_defined.reverse.push( customer_email, customer_first_name, product_info, gross, invoice, :reverse => true )
12
- fields.unshift( transaction_status )
13
- unless PayuIn.checksum(@merchant_id, @secret_key, *fields ) == checksum
14
- @message = 'Return checksum not matching the data provided'
15
- return false
16
- end
17
- true
18
- end
19
9
  end
20
10
  end
21
11
  end
@@ -5,7 +5,7 @@ module ActiveMerchant
5
5
 
6
6
  class Return < PayuIn::Return
7
7
  def initialize(query_string, options = {})
8
- super query_string, options
8
+ super
9
9
  @notification = Notification.new(query_string, options)
10
10
  end
11
11
  end
@@ -56,7 +56,7 @@ module ActiveMerchant #:nodoc:
56
56
  end
57
57
 
58
58
  # Uses Pass Through Product Parameters to pass in lineitems.
59
- # (must mark tanigble sales as shipped to settle the transaction)
59
+ # (must mark tangible sales as shipped to settle the transaction)
60
60
  def line_item(params = {})
61
61
  add_field('mode', '2CO')
62
62
  (max_existing_line_item_id = form_fields.keys.map do |key|
@@ -50,7 +50,7 @@ module ActiveMerchant #:nodoc:
50
50
  requires!(options, :amount, :description)
51
51
  options.assert_valid_keys([:description, :quantity, :amount, :discount])
52
52
 
53
- add_field("Vara_#{id}_Verd", format_amount(options[:amount]))
53
+ add_field("Vara_#{id}_Verd", format_amount(options[:amount], @fields[mappings[:currency]]))
54
54
  add_field("Vara_#{id}_Fjoldi", options[:quantity] || "1")
55
55
 
56
56
  add_field("Vara_#{id}_Lysing", options[:description]) if options[:description]
@@ -76,8 +76,8 @@ module ActiveMerchant #:nodoc:
76
76
  @fields.merge('RafraenUndirskrift' => signature)
77
77
  end
78
78
 
79
- def format_amount(amount)
80
- amount.to_f.round
79
+ def format_amount(amount, currency)
80
+ Gateway::CURRENCIES_WITHOUT_FRACTIONS.include?(currency) ? amount.to_f.round : sprintf("%.2f", amount)
81
81
  end
82
82
  end
83
83
  end
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
  end
37
37
 
38
38
  def gross
39
- "%0.2f" % params['Upphaed'].to_s
39
+ "%0.2f" % params['Upphaed'].to_s.sub(',', '.')
40
40
  end
41
41
 
42
42
  def card_type
@@ -94,4 +94,4 @@ module ActiveMerchant #:nodoc:
94
94
  end
95
95
  end
96
96
  end
97
- end
97
+ end
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
  end
41
41
  end
42
42
 
43
- # Acknowldges the payment. If the authcodes match, returns true.
43
+ # Acknowledges the payment. If the authcodes match, returns true.
44
44
  def acknowledge(authcode = nil)
45
45
  return_authcode = [params["ORDER_NUMBER"], params["TIMESTAMP"], params["PAID"], params["METHOD"], authcode].join("|")
46
46
  Digest::MD5.hexdigest(return_authcode).upcase == params["RETURN_AUTHCODE"]
@@ -7,7 +7,7 @@
7
7
  * The Plugin is provided by WDCEE free of charge for it's customers and must be used for the purpose of WDCEE's payment platform
8
8
  * integration only. It explicitly is not part of the general contract between WDCEE and it's customer. The plugin has successfully been tested
9
9
  * under specific circumstances which are defined as the shopsystem's standard configuration (vendor's delivery state). The Customer is
10
- * responsible for testing the plugin's functionality before putting it into production enviroment.
10
+ * responsible for testing the plugin's functionality before putting it into production environment.
11
11
  * The customer uses the plugin at own risk. WDCEE does not guarantee it's full functionality neither does WDCEE assume liability for any
12
12
  * disadvantage related to the use of this plugin. By installing the plugin into the shopsystem the customer agrees to the terms of use.
13
13
  * Please do not use this plugin if you do not agree to the terms of use!
@@ -58,7 +58,7 @@ module ActiveMerchant #:nodoc:
58
58
  end
59
59
 
60
60
  # Support for a MD5 hash of selected fields to prevent tampering
61
- # For futher information read the tech note at the address below:
61
+ # For further information read the tech note at the address below:
62
62
  # http://support.worldpay.com/kb/integration_guides/junior/integration/help/tech_notes/sjig_tn_009.html
63
63
  def encrypt(secret, fields = [:amount, :currency, :account, :order])
64
64
  signature_fields = fields.collect{ |field| mappings[field] }
@@ -98,4 +98,4 @@ module ActiveMerchant #:nodoc:
98
98
  end
99
99
  end
100
100
  end
101
- end
101
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.42.2"
2
+ VERSION = "1.42.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.2
4
+ version: 1.42.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -38,7 +38,7 @@ cert_chain:
38
38
  U1BPVm5oYkZKM3ZTWFkxdWxQL1I2WFc5dm53CjZra1FpMmZIaFUyMHVnTXpw
39
39
  ODgxRWl4citUakMwUnZVZXJMRzdnPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUt
40
40
  LS0tLQo=
41
- date: 2013-11-13 00:00:00.000000000 Z
41
+ date: 2013-12-18 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: activesupport
@@ -318,6 +318,7 @@ files:
318
318
  - lib/active_merchant/billing/gateways/pay_junction.rb
319
319
  - lib/active_merchant/billing/gateways/pay_secure.rb
320
320
  - lib/active_merchant/billing/gateways/paybox_direct.rb
321
+ - lib/active_merchant/billing/gateways/payex.rb
321
322
  - lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb
322
323
  - lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb
323
324
  - lib/active_merchant/billing/gateways/payflow/payflow_response.rb
@@ -335,6 +336,7 @@ files:
335
336
  - lib/active_merchant/billing/gateways/paypal_digital_goods.rb
336
337
  - lib/active_merchant/billing/gateways/paypal_express.rb
337
338
  - lib/active_merchant/billing/gateways/paypal_express_common.rb
339
+ - lib/active_merchant/billing/gateways/payscout.rb
338
340
  - lib/active_merchant/billing/gateways/paystation.rb
339
341
  - lib/active_merchant/billing/gateways/payway.rb
340
342
  - lib/active_merchant/billing/gateways/pin.rb
@@ -359,6 +361,7 @@ files:
359
361
  - lib/active_merchant/billing/gateways/secure_pay_tech.rb
360
362
  - lib/active_merchant/billing/gateways/skip_jack.rb
361
363
  - lib/active_merchant/billing/gateways/smart_ps.rb
364
+ - lib/active_merchant/billing/gateways/so_easy_pay.rb
362
365
  - lib/active_merchant/billing/gateways/spreedly_core.rb
363
366
  - lib/active_merchant/billing/gateways/stripe.rb
364
367
  - lib/active_merchant/billing/gateways/swipe_checkout.rb
@@ -442,6 +445,7 @@ files:
442
445
  - lib/active_merchant/billing/integrations/hi_trust/return.rb
443
446
  - lib/active_merchant/billing/integrations/hi_trust.rb
444
447
  - lib/active_merchant/billing/integrations/ipay88/helper.rb
448
+ - lib/active_merchant/billing/integrations/ipay88/notification.rb
445
449
  - lib/active_merchant/billing/integrations/ipay88/return.rb
446
450
  - lib/active_merchant/billing/integrations/ipay88.rb
447
451
  - lib/active_merchant/billing/integrations/liqpay/helper.rb
@@ -569,7 +573,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
569
573
  version: '0'
570
574
  requirements: []
571
575
  rubyforge_project: activemerchant
572
- rubygems_version: 2.1.10
576
+ rubygems_version: 2.1.11
573
577
  signing_key:
574
578
  specification_version: 4
575
579
  summary: Framework and tools for dealing with credit card transactions.
metadata.gz.sig CHANGED
Binary file