secure_net_recurring 1.0.0 → 1.5.0
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.
- checksums.yaml +7 -0
- data/README +63 -0
- data/lib/secure_net_recurring/version.rb +1 -1
- data/lib/secure_net_recurring.rb +78 -2
- data/secure_net_recurring.gemspec +1 -1
- metadata +9 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b95f059abf4c4f5878bf2fd8a4f728d64659762
|
4
|
+
data.tar.gz: a158f7cca1e71d3ebd482647f3d42487fcc5c91e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3e6421f41e35754f8df63f78bea28b3406e5862fdceacae24dad800ecfce4a07281ff7ecc86a98ce0ffd6972f3be0343e5be377f65b57c87d2db6f0d24d3d4f
|
7
|
+
data.tar.gz: cac9f0e666faacf05f8a3e2ab18f3a3d19beffe9110f11908bf0ed72ecc953537b8e96d146045823f75eec960576d197cc1364348b267e8d1f755dcc94be4f43
|
data/README
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
No more talk, just read SecureNet's document and follow it. Below is the information that extracted from "Gateway Implementation Guide v4 1 5 - 2013-01-07.pdf"
|
2
|
+
|
3
|
+
MERCHANT_KEY
|
4
|
+
GROUP_ID
|
5
|
+
SECUREKEY
|
6
|
+
SECURENETID
|
7
|
+
|
8
|
+
CARD
|
9
|
+
CARDCODE
|
10
|
+
CARDNUMBER
|
11
|
+
EXPDATE
|
12
|
+
|
13
|
+
INSTALLMENT
|
14
|
+
AMOUNT
|
15
|
+
AUTOCALC_OPTION (A—automatic M—manual)
|
16
|
+
BALLOON_AMOUNT (Balloon amount)
|
17
|
+
BALLOON_OPTION (AutoBill offers the capability of the balloon payment to be applied to the first or last payment, as following: 0 - add balloon amount to first payment 1 - add balloon amount to last payment)
|
18
|
+
COUNT (Number of total installments for installment plan. 1-99.)
|
19
|
+
REMAINDER_OPTION (AutoBill offers the ability to choose first or last payment if installments are not equally divided, as following: 0 - add remainder to first payment 1 - add remainder to last payment)
|
20
|
+
|
21
|
+
|
22
|
+
RECURRING
|
23
|
+
AMOUNT (Total value to be charged to the payment method specified. Include decimal point followed by decimal amount.)
|
24
|
+
NOEND_FLAG (0 = Recurring bill has an end date; 1 = Recurring bill has no end date)
|
25
|
+
|
26
|
+
|
27
|
+
OPTIONS
|
28
|
+
CYCLE
|
29
|
+
DAY (Required if CYCLE=M, Q, B, or Y)
|
30
|
+
FREQUENCY (If CYCLE=M: 1 – 11 (i.e. 2 = every 2 months))
|
31
|
+
|
32
|
+
|
33
|
+
PLAN_AB (This object defines the information that can be submitted to the Gateway for AutoBill transaction processing.)
|
34
|
+
CUSTOMERID (Contains customer ID associated with payment plan. It cannot be a valid card number.)
|
35
|
+
INSTALLMENT
|
36
|
+
MERCHANT_KEY
|
37
|
+
PAYMENTID (SecureNet Vault Payment ID. Must be enabled on the account. It cannot be a valid card number.)
|
38
|
+
RECURRING
|
39
|
+
SCHEDULE (Array of PAYMENT_AB)
|
40
|
+
STARTDATE (Plan start date. MMDDYYYY. Verify the date is on or after current date.)
|
41
|
+
TYPE (Using the “Recurring AutoBill” payments can be scheduled for daily, weekly, monthly, quarterly, and yearly recurrence.Set TYPE to one of the following: REC—for recurring INS—for installment VAR—for variable.)
|
42
|
+
|
43
|
+
|
44
|
+
TRANSACTION
|
45
|
+
MERCHANT_KEY
|
46
|
+
CARD
|
47
|
+
CHECK
|
48
|
+
CUSTOMER_BILL
|
49
|
+
CUSTOMER_SHIP
|
50
|
+
ENCRYPTION
|
51
|
+
LEVEL2
|
52
|
+
LEVEL3
|
53
|
+
MPI
|
54
|
+
AUTO
|
55
|
+
PETROLEUM
|
56
|
+
HOTEL
|
57
|
+
PRODUCT
|
58
|
+
SERVICE
|
59
|
+
USERDEFINED
|
60
|
+
SECONDARY_MERCHANT KEY
|
61
|
+
TERMINAL
|
62
|
+
HEALTHCARE
|
63
|
+
IMAGE
|
data/lib/secure_net_recurring.rb
CHANGED
@@ -4,12 +4,88 @@ module ActiveMerchant
|
|
4
4
|
module Billing
|
5
5
|
class SecureNetGateway < Gateway
|
6
6
|
|
7
|
+
class_attribute :recurring_url
|
8
|
+
|
7
9
|
#self.test_url = 'https://certify.securenet.com/API/gateway.svc/webHttp/ProcessTransaction'
|
8
10
|
self.recurring_url = 'https://gateway.securenet.com/API/data/service.svc/webHttp/AddABAccount'
|
9
11
|
|
10
|
-
def recurring
|
11
|
-
|
12
|
+
def recurring(money, creditcard, options = {})
|
13
|
+
recurring_commit(build_recurring_plan_ab(creditcard, options, :recurring, money))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def recurring_commit(request)
|
18
|
+
xml = build_request(request)
|
19
|
+
url = self.recurring_url
|
20
|
+
data = ssl_post(url, xml, "Content-Type" => "text/xml")
|
21
|
+
response = parse(data)
|
22
|
+
|
23
|
+
Response.new(success?(response), message_from(response), response,
|
24
|
+
:test => test?,
|
25
|
+
:authorization => build_authorization(response),
|
26
|
+
:avs_result => { :code => response[:avs_result_code] },
|
27
|
+
:cvv_result => response[:card_code_response_code]
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def build_request(request)
|
32
|
+
xml = Builder::XmlMarkup.new
|
33
|
+
|
34
|
+
xml.instruct!
|
35
|
+
xml.tag!("PLAN_AB", XML_ATTRIBUTES) do
|
36
|
+
xml << request
|
37
|
+
end
|
38
|
+
|
39
|
+
xml.target!
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_recurring_plan_ab(creditcard, options, action, money)
|
43
|
+
xml = Builder::XmlMarkup.new
|
44
|
+
|
45
|
+
xml.tag! 'CUSTOMERID', creditcard.number
|
46
|
+
add_options(xml, creditcard)
|
47
|
+
add_installment(xml, creditcard, money)
|
48
|
+
add_merchant_key(xml, options)
|
49
|
+
xml.tag! 'PAYMENTID', creditcard.number
|
50
|
+
add_recurring(xml, creditcard, money)
|
51
|
+
add_schedule(xml, creditcard)
|
52
|
+
xml.tag! 'STARTDATE', "02202014"
|
53
|
+
xml.tag! 'TYPE', "REC"
|
54
|
+
|
55
|
+
xml.target!
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_options(xml, creditcard)
|
59
|
+
xml.tag!("OPTIONS") do
|
60
|
+
xml.tag! 'CYCLE', 'M'
|
61
|
+
xml.tag! 'DAY', 5 #Integer / 2
|
62
|
+
xml.tag! 'FREQUENCY', 1 #Integer / 2
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def add_installment(xml, creditcard, money)
|
67
|
+
xml.tag!("INSTALLMENT") do
|
68
|
+
xml.tag! 'AMOUNT', amount(money)
|
69
|
+
xml.tag! 'AUTOCALC_OPTION', 'A'
|
70
|
+
xml.tag! 'BALLOON_AMOUNT', 0
|
71
|
+
xml.tag! 'BALLOON_OPTION', 1
|
72
|
+
xml.tag! 'COUNT', 1
|
73
|
+
xml.tag! 'REMAINDER_OPTION', 1
|
74
|
+
end
|
12
75
|
end
|
76
|
+
|
77
|
+
def add_recurring(xml, creditcard, money)
|
78
|
+
xml.tag!("RECURRING") do
|
79
|
+
xml.tag! 'AMOUNT', amount(money)
|
80
|
+
xml.tag! 'NOEND_FLAG', 1
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def add_schedule(xml, creditcard)
|
85
|
+
xml.tag!("SCHEDULE") do
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
13
89
|
end
|
14
90
|
end
|
15
91
|
end
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["wenbo"]
|
10
10
|
s.email = ["yiyun6674@hotmail.com"]
|
11
11
|
s.homepage = "http://rubygems.org/gems/secure_net_recurring"
|
12
|
-
s.summary = "Standing on the shoulder of gem activemerchant,this gem implements SecureNet's
|
12
|
+
s.summary = "Standing on the shoulder of gem activemerchant,this gem implements SecureNet's AuthBill feature"
|
13
13
|
s.description = s.summary
|
14
14
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secure_net_recurring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- wenbo
|
@@ -14,7 +13,6 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activemerchant
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,13 +20,12 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.32.1
|
30
27
|
description: Standing on the shoulder of gem activemerchant,this gem implements SecureNet's
|
31
|
-
|
28
|
+
AuthBill feature
|
32
29
|
email:
|
33
30
|
- yiyun6674@hotmail.com
|
34
31
|
executables: []
|
@@ -36,33 +33,32 @@ extensions: []
|
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
38
35
|
- MIT-LICENSE
|
36
|
+
- README
|
39
37
|
- lib/secure_net_recurring.rb
|
40
38
|
- lib/secure_net_recurring/version.rb
|
41
39
|
- secure_net_recurring.gemspec
|
42
40
|
homepage: http://rubygems.org/gems/secure_net_recurring
|
43
41
|
licenses: []
|
42
|
+
metadata: {}
|
44
43
|
post_install_message:
|
45
44
|
rdoc_options: []
|
46
45
|
require_paths:
|
47
46
|
- lib
|
48
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
48
|
requirements:
|
51
|
-
- -
|
49
|
+
- - '>='
|
52
50
|
- !ruby/object:Gem::Version
|
53
51
|
version: '0'
|
54
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
53
|
requirements:
|
57
|
-
- -
|
54
|
+
- - '>='
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0'
|
60
57
|
requirements: []
|
61
58
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
59
|
+
rubygems_version: 2.1.11
|
63
60
|
signing_key:
|
64
|
-
specification_version:
|
61
|
+
specification_version: 4
|
65
62
|
summary: Standing on the shoulder of gem activemerchant,this gem implements SecureNet's
|
66
|
-
|
63
|
+
AuthBill feature
|
67
64
|
test_files: []
|
68
|
-
has_rdoc:
|