johnideal-activemerchant 1.4.5 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/activemerchant.gemspec +7 -2
- data/lib/active_merchant/billing/gateways/paymentech_orbital/end_of_day_request.rb +14 -0
- data/lib/active_merchant/billing/gateways/paymentech_orbital/new_order_request.rb +112 -0
- data/lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_request.rb +53 -0
- data/lib/active_merchant/billing/gateways/paymentech_orbital/profile_management_request.rb +74 -0
- data/lib/active_merchant/billing/gateways/paymentech_orbital/void_request.rb +31 -0
- metadata +8 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.6
|
data/activemerchant.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{activemerchant}
|
5
|
-
s.version = "1.4.
|
5
|
+
s.version = "1.4.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Tobias Luetke"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-31}
|
10
10
|
s.email = %q{tobi@leetsoft.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"README"
|
@@ -79,7 +79,12 @@ Gem::Specification.new do |s|
|
|
79
79
|
"lib/active_merchant/billing/gateways/payflow_uk.rb",
|
80
80
|
"lib/active_merchant/billing/gateways/payment_express.rb",
|
81
81
|
"lib/active_merchant/billing/gateways/paymentech_orbital.rb",
|
82
|
+
"lib/active_merchant/billing/gateways/paymentech_orbital/end_of_day_request.rb",
|
83
|
+
"lib/active_merchant/billing/gateways/paymentech_orbital/new_order_request.rb",
|
84
|
+
"lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_request.rb",
|
82
85
|
"lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb",
|
86
|
+
"lib/active_merchant/billing/gateways/paymentech_orbital/profile_management_request.rb",
|
87
|
+
"lib/active_merchant/billing/gateways/paymentech_orbital/void_request.rb",
|
83
88
|
"lib/active_merchant/billing/gateways/paypal.rb",
|
84
89
|
"lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb",
|
85
90
|
"lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb",
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class EndOfDayRequest < PaymentechOrbitalRequest
|
2
|
+
def request_type; "EndOfDay"; end
|
3
|
+
|
4
|
+
private
|
5
|
+
def request_body(xml)
|
6
|
+
add_meta_info(xml)
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_meta_info(xml)
|
10
|
+
xml.tag! "BIN", bin
|
11
|
+
xml.tag! "MerchantID", merchant_id
|
12
|
+
xml.tag! "TerminalID", terminal_id
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
class NewOrderRequest < PaymentechOrbitalRequest
|
2
|
+
attr_reader :message_type, :money, :credit_card, :industry_type
|
3
|
+
|
4
|
+
def initialize(message_type, money, credit_card, options)
|
5
|
+
@message_type = message_type
|
6
|
+
@money = money
|
7
|
+
@credit_card = credit_card
|
8
|
+
super(options)
|
9
|
+
end
|
10
|
+
|
11
|
+
[:industry_type, :mb_type, :recurring_start_date,
|
12
|
+
:recurring_end_date, :recurring_end_date_flag,
|
13
|
+
:recurring_max_billings, :recurring_frequency,
|
14
|
+
:deferred_bill_date, :soft_descriptors].each do |attr|
|
15
|
+
define_method(:"#{attr}") do
|
16
|
+
options[:"#{attr}"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_type; "NewOrder"; end
|
21
|
+
|
22
|
+
def recurring?
|
23
|
+
industry_type == "RC"
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def request_body(xml)
|
28
|
+
add_meta_info(xml)
|
29
|
+
add_credit_card(xml)
|
30
|
+
add_billing_address(xml)
|
31
|
+
add_profile_management_options(xml)
|
32
|
+
add_order_information(xml)
|
33
|
+
add_soft_descriptor_info(xml)
|
34
|
+
add_managed_billing_info(xml)
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_meta_info(xml)
|
38
|
+
xml.tag! "IndustryType", industry_type || "EC"
|
39
|
+
xml.tag! "MessageType", message_type
|
40
|
+
xml.tag! "BIN", bin
|
41
|
+
xml.tag! "MerchantID", merchant_id
|
42
|
+
xml.tag! "TerminalID", terminal_id
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_credit_card(xml)
|
46
|
+
if credit_card
|
47
|
+
xml.tag! "CardBrand", credit_card.respond_to?(:brand) ? credit_card.brand : credit_card.type
|
48
|
+
xml.tag! "AccountNum", credit_card.number
|
49
|
+
xml.tag! "Exp", "#{credit_card.month}#{credit_card.year}"
|
50
|
+
add_currency(xml)
|
51
|
+
xml.tag! "CardSecValInd", "1"
|
52
|
+
xml.tag! "CardSecVal", credit_card.verification_value
|
53
|
+
else
|
54
|
+
xml.tag! "AccountNum", nil
|
55
|
+
add_currency(xml)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_currency(xml)
|
60
|
+
xml.tag! "CurrencyCode", currency_code
|
61
|
+
xml.tag! "CurrencyExponent", currency_exponent
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_billing_address(xml)
|
65
|
+
xml.tag! "AVSzip", address[:zip]
|
66
|
+
xml.tag! "AVSaddress1", address[:address1]
|
67
|
+
xml.tag! "AVSaddress2", address[:address2]
|
68
|
+
xml.tag! "AVScity", address[:city]
|
69
|
+
xml.tag! "AVSstate", address[:state]
|
70
|
+
xml.tag! "AVSphoneNum" , address[:phone]
|
71
|
+
xml.tag! "AVSname", address[:name]
|
72
|
+
xml.tag! "AVScountryCode", address[:country]
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_profile_management_options(xml)
|
76
|
+
if customer_ref_num
|
77
|
+
xml.tag! "CustomerRefNum", customer_ref_num
|
78
|
+
else
|
79
|
+
xml.tag! "CustomerProfileFromOrderInd", "A"
|
80
|
+
xml.tag! "CustomerProfileOrderOverrideInd", "NO"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def add_order_information(xml)
|
85
|
+
xml.tag! "OrderID", order_id
|
86
|
+
xml.tag! "Amount", money
|
87
|
+
end
|
88
|
+
|
89
|
+
def add_soft_descriptor_info(xml)
|
90
|
+
if soft_descriptors
|
91
|
+
xml.tag! "SDMerchantName", soft_descriptors[:merchant_name]
|
92
|
+
xml.tag! "SDProductDescription", soft_descriptors[:production_description]
|
93
|
+
xml.tag! "SDMerchantCity", soft_descriptors[:merchant_city]
|
94
|
+
xml.tag! "SDMerchantPhone", soft_descriptors[:merchant_phone]
|
95
|
+
xml.tag! "SDMerchantURL", soft_descriptors[:merchant_url]
|
96
|
+
xml.tag! "SDMerchantEmail", soft_descriptors[:merchant_email]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_managed_billing_info(xml)
|
101
|
+
if recurring?
|
102
|
+
xml.tag! "MBType", mb_type || "R"
|
103
|
+
xml.tag! "MBOrderIdGenerationMethod", "DI"
|
104
|
+
xml.tag! "MBRecurringStartDate", recurring_start_date || (Date.today + 1).strftime("%m%d%Y")
|
105
|
+
xml.tag! "MBRecurringEndDate", recurring_end_date
|
106
|
+
xml.tag! "MBRecurringNoEndDateFlag", recurring_end_date_flag || (recurring_end_date ? "N" : "Y")
|
107
|
+
xml.tag! "MBRecurringMaxBillings", recurring_max_billings
|
108
|
+
xml.tag! "MBRecurringFrequency", recurring_frequency
|
109
|
+
xml.tag! "MBDeferredBillDate", deferred_bill_date
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class PaymentechOrbitalRequest
|
2
|
+
attr_reader :gateway, :options
|
3
|
+
|
4
|
+
def initialize(options={})
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_xml
|
9
|
+
@_xml ||= build_request(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
# Delegate these to options hash.
|
14
|
+
[:login, :password, :merchant_id,
|
15
|
+
:bin, :terminal_id, :currency_code,
|
16
|
+
:currency_exponent, :customer_ref_num,
|
17
|
+
:order_id].each do |attr|
|
18
|
+
define_method(:"#{attr}") do
|
19
|
+
options[:"#{attr}"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def address
|
24
|
+
@_address ||= options[:billing_address] || options[:address] || {}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Implement me. I should be the parent tag for the request.
|
28
|
+
def request_type; "RequestType"; end
|
29
|
+
|
30
|
+
def build_request(options={})
|
31
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
32
|
+
|
33
|
+
xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
|
34
|
+
xml.tag! "Request" do
|
35
|
+
xml.tag! request_type do
|
36
|
+
add_authentication(xml)
|
37
|
+
|
38
|
+
request_body(xml)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
xml.target!
|
43
|
+
end
|
44
|
+
|
45
|
+
# Implement me. I should take the provided
|
46
|
+
# xml builder and add tags to the request.
|
47
|
+
def request_body(xml); xml; end
|
48
|
+
|
49
|
+
def add_authentication(xml)
|
50
|
+
xml.tag! "OrbitalConnectionUsername", login
|
51
|
+
xml.tag! "OrbitalConnectionPassword", password
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class ProfileManagementRequest < PaymentechOrbitalRequest
|
2
|
+
attr_accessor :action, :credit_card
|
3
|
+
|
4
|
+
cattr_accessor :action_map
|
5
|
+
self.action_map = {
|
6
|
+
"create" => "C",
|
7
|
+
"retreive" => "R",
|
8
|
+
"update" => "U",
|
9
|
+
"delete" => "D"
|
10
|
+
}
|
11
|
+
|
12
|
+
def initialize(action, credit_card=nil, options={})
|
13
|
+
@action = action
|
14
|
+
@credit_card = credit_card
|
15
|
+
super(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def request_type; "Profile"; end
|
19
|
+
|
20
|
+
private
|
21
|
+
def customer_profile_action(action)
|
22
|
+
self.class.action_map[action.downcase.to_s]
|
23
|
+
end
|
24
|
+
|
25
|
+
def writing?
|
26
|
+
["create", "update"].include?(action)
|
27
|
+
end
|
28
|
+
|
29
|
+
def request_body(xml)
|
30
|
+
add_meta_info(xml)
|
31
|
+
add_profile_info(xml)
|
32
|
+
|
33
|
+
xml.tag! "CustomerProfileAction", customer_profile_action(action)
|
34
|
+
|
35
|
+
add_customer_profile_management_options(xml)
|
36
|
+
add_account_info(xml) if writing?
|
37
|
+
add_credit_card_info(xml) if writing? && credit_card
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_meta_info(xml)
|
41
|
+
xml.tag! "CustomerBin", bin
|
42
|
+
xml.tag! "CustomerMerchantID", merchant_id
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_profile_info(xml)
|
46
|
+
xml.tag! "CustomerName", address[:name]
|
47
|
+
xml.tag! "CustomerRefNum", customer_ref_num if customer_ref_num
|
48
|
+
xml.tag! "CustomerAddress1", address[:address1]
|
49
|
+
xml.tag! "CustomerAddress2", address[:address]
|
50
|
+
xml.tag! "CustomerCity", address[:city]
|
51
|
+
xml.tag! "CustomerState", address[:state]
|
52
|
+
xml.tag! "CustomerZIP", address[:zip]
|
53
|
+
xml.tag! "CustomerEmail", address[:email]
|
54
|
+
xml.tag! "CustomerPhone", address[:phone]
|
55
|
+
xml.tag! "CustomerCountryCode", address[:country]
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_customer_profile_management_options(xml)
|
59
|
+
unless customer_ref_num
|
60
|
+
xml.tag! "CustomerProfileOrderOverrideInd", "NO"
|
61
|
+
xml.tag! "CustomerProfileFromOrderInd", "A"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_account_info(xml)
|
66
|
+
xml.tag! "CustomerAccountType", "CC"
|
67
|
+
xml.tag! "Status", options[:status] || "A"
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_credit_card_info(xml)
|
71
|
+
xml.tag! "CCAccountNum", credit_card.number
|
72
|
+
xml.tag! "CCExpireDate", "#{credit_card.month}#{credit_card.year}"
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class VoidRequest < PaymentechOrbitalRequest
|
2
|
+
attr_reader :tx_ref_num, :tx_ref_idx, :money
|
3
|
+
|
4
|
+
def initialize(tx_ref_num, tx_ref_idx, money=nil, options={})
|
5
|
+
@tx_ref_num = tx_ref_num
|
6
|
+
@tx_ref_idx = tx_ref_idx
|
7
|
+
@money = money
|
8
|
+
super(options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def request_type; "Reversal"; end
|
12
|
+
|
13
|
+
private
|
14
|
+
def request_body(xml)
|
15
|
+
add_transaction_info(xml)
|
16
|
+
xml.tag! "AdjustedAmt", money if money
|
17
|
+
add_meta_info(xml)
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_transaction_info(xml)
|
21
|
+
xml.tag! "TxRefNum", tx_ref_num
|
22
|
+
xml.tag! "TxRefIdx", tx_ref_idx
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_meta_info(xml)
|
26
|
+
xml.tag! "OrderID", order_id
|
27
|
+
xml.tag! "BIN", bin
|
28
|
+
xml.tag! "MerchantID", merchant_id
|
29
|
+
xml.tag! "TerminalID", terminal_id
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: johnideal-activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -89,7 +89,12 @@ files:
|
|
89
89
|
- lib/active_merchant/billing/gateways/payflow_uk.rb
|
90
90
|
- lib/active_merchant/billing/gateways/payment_express.rb
|
91
91
|
- lib/active_merchant/billing/gateways/paymentech_orbital.rb
|
92
|
+
- lib/active_merchant/billing/gateways/paymentech_orbital/end_of_day_request.rb
|
93
|
+
- lib/active_merchant/billing/gateways/paymentech_orbital/new_order_request.rb
|
94
|
+
- lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_request.rb
|
92
95
|
- lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb
|
96
|
+
- lib/active_merchant/billing/gateways/paymentech_orbital/profile_management_request.rb
|
97
|
+
- lib/active_merchant/billing/gateways/paymentech_orbital/void_request.rb
|
93
98
|
- lib/active_merchant/billing/gateways/paypal.rb
|
94
99
|
- lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb
|
95
100
|
- lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb
|
@@ -323,7 +328,6 @@ files:
|
|
323
328
|
- test/unit/validateable_test.rb
|
324
329
|
has_rdoc: false
|
325
330
|
homepage: http://activemerchant.org/
|
326
|
-
licenses:
|
327
331
|
post_install_message:
|
328
332
|
rdoc_options:
|
329
333
|
- --charset=UTF-8
|
@@ -344,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
348
|
requirements: []
|
345
349
|
|
346
350
|
rubyforge_project:
|
347
|
-
rubygems_version: 1.
|
351
|
+
rubygems_version: 1.2.0
|
348
352
|
signing_key:
|
349
353
|
specification_version: 3
|
350
354
|
summary: Framework and tools for dealing with credit card transactions.
|