activemerchant 1.32.1 → 1.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +41 -0
  3. data/CONTRIBUTORS +8 -0
  4. data/README.md +6 -4
  5. data/lib/active_merchant/billing/check.rb +4 -3
  6. data/lib/active_merchant/billing/credit_card.rb +7 -3
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +27 -7
  8. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +8 -1
  9. data/lib/active_merchant/billing/gateways/blue_pay.rb +201 -185
  10. data/lib/active_merchant/billing/gateways/bogus.rb +1 -1
  11. data/lib/active_merchant/billing/gateways/card_stream_modern.rb +155 -0
  12. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +94 -12
  13. data/lib/active_merchant/billing/gateways/litle.rb +41 -11
  14. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +27 -6
  15. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +2 -2
  16. data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
  17. data/lib/active_merchant/billing/gateways/netaxept.rb +65 -117
  18. data/lib/active_merchant/billing/gateways/orbital.rb +181 -48
  19. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -10
  20. data/lib/active_merchant/billing/gateways/paymill.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +11 -6
  22. data/lib/active_merchant/billing/gateways/paypal_express.rb +25 -7
  23. data/lib/active_merchant/billing/gateways/pin.rb +5 -5
  24. data/lib/active_merchant/billing/gateways/sage.rb +10 -5
  25. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +16 -11
  26. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +21 -16
  28. data/lib/active_merchant/billing/gateways/sage_pay.rb +1 -0
  29. data/lib/active_merchant/billing/gateways/transnational.rb +239 -0
  30. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +8 -3
  31. data/lib/active_merchant/billing/integrations/direc_pay.rb +1 -1
  32. data/lib/active_merchant/billing/integrations/direc_pay/status.rb +1 -1
  33. data/lib/active_merchant/billing/integrations/dwolla.rb +5 -12
  34. data/lib/active_merchant/billing/integrations/dwolla/common.rb +21 -0
  35. data/lib/active_merchant/billing/integrations/dwolla/helper.rb +15 -6
  36. data/lib/active_merchant/billing/integrations/dwolla/notification.rb +11 -6
  37. data/lib/active_merchant/billing/integrations/dwolla/return.rb +12 -4
  38. data/lib/active_merchant/billing/integrations/notification.rb +13 -8
  39. data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +13 -1
  40. data/lib/active_merchant/billing/integrations/payu_in.rb +43 -0
  41. data/lib/active_merchant/billing/integrations/payu_in/helper.rb +74 -0
  42. data/lib/active_merchant/billing/integrations/payu_in/notification.rb +167 -0
  43. data/lib/active_merchant/billing/integrations/payu_in/return.rb +53 -0
  44. data/lib/active_merchant/billing/integrations/quickpay/notification.rb +68 -5
  45. data/lib/active_merchant/billing/integrations/rbkmoney.rb +17 -0
  46. data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +23 -0
  47. data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +91 -0
  48. data/lib/active_merchant/version.rb +1 -1
  49. metadata +14 -4
  50. metadata.gz.sig +0 -0
@@ -0,0 +1,53 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module PayuIn
5
+ class Return < ActiveMerchant::Billing::Integrations::Return
6
+
7
+ def initialize(query_string, options = {})
8
+ super
9
+ @notification = Notification.new(query_string, options)
10
+ end
11
+
12
+ # PayU Transaction Id
13
+ #
14
+ def transaction_id
15
+ @notification.transaction_id
16
+ end
17
+
18
+ # Returns the status of the transaction as a string
19
+ # The status can be one of the following
20
+ #
21
+ # invalid - transaction id not present
22
+ # tampered - checksum does not mismatch
23
+ # mismatch - order id mismatch
24
+ # success - transaction success
25
+ # pending - transaction pending
26
+ # failure - transaction failure
27
+ #
28
+ # payu does not put the discount field in the checksum
29
+ # it can be easily forged by the attacker without detection
30
+ #
31
+ def status( order_id, order_amount )
32
+ if @notification.invoice_ok?( order_id ) && @notification.amount_ok?( BigDecimal.new(order_amount) )
33
+ @notification.status
34
+ else
35
+ 'mismatch'
36
+ end
37
+ end
38
+
39
+ # check success of the transaction
40
+ # check order_id and
41
+ def success?
42
+ status( @params['txnid'], @params['amount'] ) == 'success'
43
+ end
44
+
45
+ def message
46
+ @notification.message
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -41,17 +41,54 @@ module ActiveMerchant #:nodoc:
41
41
  end
42
42
 
43
43
  # Provide access to raw fields from quickpay
44
- %w(msgtype ordernumber state chstat chstatmsg qpstat qpstatmsg merchant merchantemail cardtype cardnumber splitpayment fraudprobability fraudremarks fraudreport fee).each do |attr|
44
+ %w(
45
+ msgtype
46
+ ordernumber
47
+ state
48
+ chstat
49
+ chstatmsg
50
+ qpstat
51
+ qpstatmsg
52
+ merchant
53
+ merchantemail
54
+ cardtype
55
+ cardnumber
56
+ cardhash
57
+ cardexpire
58
+ splitpayment
59
+ fraudprobability
60
+ fraudremarks
61
+ fraudreport
62
+ fee
63
+ ).each do |attr|
45
64
  define_method(attr) do
46
65
  params[attr]
47
66
  end
48
67
  end
49
68
 
50
69
  MD5_CHECK_FIELDS = [
51
- :msgtype, :ordernumber, :amount, :currency, :time, :state,
52
- :qpstat, :qpstatmsg, :chstat, :chstatmsg, :merchant, :merchantemail,
53
- :transaction, :cardtype, :cardnumber, :splitpayment, :fraudprobability,
54
- :fraudremarks, :fraudreport, :fee
70
+ :msgtype,
71
+ :ordernumber,
72
+ :amount,
73
+ :currency,
74
+ :time,
75
+ :state,
76
+ :qpstat,
77
+ :qpstatmsg,
78
+ :chstat,
79
+ :chstatmsg,
80
+ :merchant,
81
+ :merchantemail,
82
+ :transaction,
83
+ :cardtype,
84
+ :cardnumber,
85
+ :cardhash,
86
+ :cardexpire,
87
+ :splitpayment,
88
+ :fraudprobability,
89
+ :fraudremarks,
90
+ :fraudreport,
91
+ :fee
55
92
  ]
56
93
 
57
94
  def generate_md5string
@@ -67,6 +104,32 @@ module ActiveMerchant #:nodoc:
67
104
  def acknowledge
68
105
  generate_md5check == params['md5check']
69
106
  end
107
+
108
+ # Take the posted data and move the relevant data into a hash
109
+ def parse(post)
110
+ # 30 + 12
111
+ #------------------------------8a827a0e6829
112
+ #Content-Disposition: form-data; name="msgtype"
113
+ #
114
+ #subscribe
115
+ #------------------------------8a827a0e6829
116
+ #Content-Disposition: form-data; name="ordernumber"
117
+ #
118
+ #BILP94406
119
+
120
+ if post =~ /-{20,40}\w{6,24}/
121
+ @raw = post.to_s
122
+ post.split(/-{20,40}\w{6,24}[\n\r]*/m).each do |part|
123
+ part.scan(/([^\n\r]+)[\n\r]+([^\n\r]*)/m) do |header, value|
124
+ if header.match(/name=["'](.*)["']/)
125
+ params[$1] = value.strip
126
+ end
127
+ end
128
+ end
129
+ else
130
+ super
131
+ end
132
+ end
70
133
  end
71
134
  end
72
135
  end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/rbkmoney/helper.rb'
2
+ require File.dirname(__FILE__) + '/rbkmoney/notification.rb'
3
+
4
+ module ActiveMerchant #:nodoc:
5
+ module Billing #:nodoc:
6
+ module Integrations #:nodoc:
7
+ module Rbkmoney
8
+ mattr_accessor :service_url
9
+ self.service_url = 'https://rbkmoney.ru/acceptpurchase.aspx'
10
+
11
+ def self.notification(*args)
12
+ Notification.new(*args)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Rbkmoney
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+ mapping :account, 'eshopId'
7
+ mapping :amount, 'recipientAmount'
8
+
9
+ # NOTE: rbkmoney uses outdated currency code 'RUR'
10
+ mapping :currency, 'recipientCurrency'
11
+
12
+ mapping :order, 'orderId'
13
+
14
+ mapping :customer, :email => 'user_email'
15
+
16
+ mapping :credential2, 'serviceName'
17
+ mapping :credential3, 'successUrl'
18
+ mapping :credential4, 'failUrl'
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,91 @@
1
+ require 'net/http'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ module Integrations #:nodoc:
6
+ module Rbkmoney
7
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
8
+ %w(
9
+ eshopId
10
+ paymentId
11
+ orderId
12
+ eshopAccount
13
+ serviceName
14
+ recipientAmount
15
+ recipientCurrency
16
+ paymentStatus
17
+ userName
18
+ userEmail
19
+ paymentData
20
+ secretKey
21
+ hash
22
+ ).each do |param_name|
23
+ define_method(param_name.underscore){ params[param_name] }
24
+ end
25
+
26
+ def complete?
27
+ (payment_status == '5')
28
+ end
29
+
30
+ def test?
31
+ false
32
+ end
33
+
34
+ def status
35
+ case payment_status
36
+ when '3'
37
+ 'pending'
38
+ when '5'
39
+ 'completed'
40
+ else 'unknown'
41
+ end
42
+ end
43
+
44
+ def user_fields
45
+ params.inject({}) do |fields, (k,v)|
46
+ if /\AuserField_[\d+]\z/.match(k)
47
+ fields[k] = v
48
+ end
49
+ fields
50
+ end
51
+ end
52
+
53
+ alias_method :client_id, :eshop_id
54
+ alias_method :item_id, :order_id
55
+ alias_method :transaction_id, :payment_id
56
+ alias_method :received_at, :payment_data
57
+ alias_method :payer_email, :user_email
58
+ alias_method :gross, :recipient_amount
59
+ alias_method :currency, :recipient_currency
60
+
61
+ def acknowledge
62
+ string = [
63
+ eshop_id,
64
+ order_id,
65
+ service_name,
66
+ eshop_account,
67
+ recipient_amount,
68
+ recipient_currency,
69
+ payment_status,
70
+ user_name,
71
+ user_email,
72
+ payment_data,
73
+ @options[:secret]
74
+ ].join '::'
75
+
76
+ signature = case hash.to_s.length
77
+ when 32
78
+ Digest::MD5.hexdigest(string)
79
+ when 128
80
+ Digest::SHA512.hexdigest(string)
81
+ else
82
+ return false
83
+ end
84
+
85
+ signature == hash
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.32.1"
2
+ VERSION = "1.33.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.32.1
5
+ version: 1.33.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tobias Luetke
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Z1BvU1BxN25rK3MyRlFVQko5VVpGSzFsZ016aG8vNGZaZ3pKd2J1K2NPOFNO
38
38
  dWFMUy9iagpoUGFTVHlWVTB5Q1Nudz09Ci0tLS0tRU5EIENFUlRJRklDQVRF
39
39
  LS0tLS0K
40
- date: 2013-04-04 00:00:00.000000000 Z
40
+ date: 2013-05-30 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -172,7 +172,7 @@ dependencies:
172
172
  requirements:
173
173
  - - ~>
174
174
  - !ruby/object:Gem::Version
175
- version: 0.11.3
175
+ version: 0.13.0
176
176
  none: false
177
177
  name: mocha
178
178
  type: :development
@@ -181,7 +181,7 @@ dependencies:
181
181
  requirements:
182
182
  - - ~>
183
183
  - !ruby/object:Gem::Version
184
- version: 0.11.3
184
+ version: 0.13.0
185
185
  none: false
186
186
  - !ruby/object:Gem::Dependency
187
187
  version_requirements: !ruby/object:Gem::Requirement
@@ -255,6 +255,7 @@ files:
255
255
  - lib/active_merchant/billing/gateways/braintree_orange.rb
256
256
  - lib/active_merchant/billing/gateways/card_save.rb
257
257
  - lib/active_merchant/billing/gateways/card_stream.rb
258
+ - lib/active_merchant/billing/gateways/card_stream_modern.rb
258
259
  - lib/active_merchant/billing/gateways/cc5.rb
259
260
  - lib/active_merchant/billing/gateways/certo_direct.rb
260
261
  - lib/active_merchant/billing/gateways/cyber_source.rb
@@ -356,6 +357,7 @@ files:
356
357
  - lib/active_merchant/billing/gateways/stripe.rb
357
358
  - lib/active_merchant/billing/gateways/trans_first.rb
358
359
  - lib/active_merchant/billing/gateways/transax.rb
360
+ - lib/active_merchant/billing/gateways/transnational.rb
359
361
  - lib/active_merchant/billing/gateways/trust_commerce.rb
360
362
  - lib/active_merchant/billing/gateways/usa_epay.rb
361
363
  - lib/active_merchant/billing/gateways/usa_epay_advanced.rb
@@ -396,6 +398,7 @@ files:
396
398
  - lib/active_merchant/billing/integrations/dotpay/notification.rb
397
399
  - lib/active_merchant/billing/integrations/dotpay/return.rb
398
400
  - lib/active_merchant/billing/integrations/dotpay.rb
401
+ - lib/active_merchant/billing/integrations/dwolla/common.rb
399
402
  - lib/active_merchant/billing/integrations/dwolla/helper.rb
400
403
  - lib/active_merchant/billing/integrations/dwolla/notification.rb
401
404
  - lib/active_merchant/billing/integrations/dwolla/return.rb
@@ -459,6 +462,10 @@ files:
459
462
  - lib/active_merchant/billing/integrations/paysbuy/helper.rb
460
463
  - lib/active_merchant/billing/integrations/paysbuy/notification.rb
461
464
  - lib/active_merchant/billing/integrations/paysbuy.rb
465
+ - lib/active_merchant/billing/integrations/payu_in/helper.rb
466
+ - lib/active_merchant/billing/integrations/payu_in/notification.rb
467
+ - lib/active_merchant/billing/integrations/payu_in/return.rb
468
+ - lib/active_merchant/billing/integrations/payu_in.rb
462
469
  - lib/active_merchant/billing/integrations/pxpay/helper.rb
463
470
  - lib/active_merchant/billing/integrations/pxpay/notification.rb
464
471
  - lib/active_merchant/billing/integrations/pxpay/return.rb
@@ -466,6 +473,9 @@ files:
466
473
  - lib/active_merchant/billing/integrations/quickpay/helper.rb
467
474
  - lib/active_merchant/billing/integrations/quickpay/notification.rb
468
475
  - lib/active_merchant/billing/integrations/quickpay.rb
476
+ - lib/active_merchant/billing/integrations/rbkmoney/helper.rb
477
+ - lib/active_merchant/billing/integrations/rbkmoney/notification.rb
478
+ - lib/active_merchant/billing/integrations/rbkmoney.rb
469
479
  - lib/active_merchant/billing/integrations/return.rb
470
480
  - lib/active_merchant/billing/integrations/robokassa/common.rb
471
481
  - lib/active_merchant/billing/integrations/robokassa/helper.rb
metadata.gz.sig CHANGED
Binary file