johnreitano-activemerchant 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -156,6 +156,16 @@ module ActiveMerchant #:nodoc:
|
|
156
156
|
commit(build_update_subscription_request(identification, options), options)
|
157
157
|
end
|
158
158
|
|
159
|
+
def retrieve_subscription(subscription_id, options = {})
|
160
|
+
requires!(options, :order_id)
|
161
|
+
commit(build_retrieve_subscription_request(subscription_id, options), options)
|
162
|
+
end
|
163
|
+
|
164
|
+
def delete_subscription(subscription_id, options = {})
|
165
|
+
requires!(options, :order_id)
|
166
|
+
commit(build_delete_subscription_request(subscription_id, options), options)
|
167
|
+
end
|
168
|
+
|
159
169
|
# CyberSource requires that you provide line item information for tax calculations
|
160
170
|
# If you do not have prices for each item or want to simplify the situation then pass in one fake line item that costs the subtotal of the order
|
161
171
|
#
|
@@ -318,6 +328,26 @@ module ActiveMerchant #:nodoc:
|
|
318
328
|
xml.target!
|
319
329
|
end
|
320
330
|
|
331
|
+
def build_retrieve_subscription_request(subscription_id, options)
|
332
|
+
options[:subscription] ||= {}
|
333
|
+
options[:subscription][:subscription_id] = subscription_id
|
334
|
+
|
335
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
336
|
+
add_subscription(xml, options)
|
337
|
+
add_subscription_retrieve_service(xml, options)
|
338
|
+
xml.target!
|
339
|
+
end
|
340
|
+
|
341
|
+
def build_delete_subscription_request(subscription_id, options)
|
342
|
+
options[:subscription] ||= {}
|
343
|
+
options[:subscription][:subscription_id] = subscription_id
|
344
|
+
|
345
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
346
|
+
add_subscription(xml, options)
|
347
|
+
add_subscription_delete_service(xml, options)
|
348
|
+
xml.target!
|
349
|
+
end
|
350
|
+
|
321
351
|
def add_business_rules_data(xml)
|
322
352
|
xml.tag! 'businessRules' do
|
323
353
|
xml.tag!('ignoreAVSResult', 'true') if @options[:ignore_avs]
|
@@ -464,6 +494,14 @@ module ActiveMerchant #:nodoc:
|
|
464
494
|
xml.tag! 'paySubscriptionUpdateService', {'run' => 'true'}
|
465
495
|
end
|
466
496
|
|
497
|
+
def add_subscription_retrieve_service(xml, options)
|
498
|
+
xml.tag! 'paySubscriptionRetrieveService', {'run' => 'true'}
|
499
|
+
end
|
500
|
+
|
501
|
+
def add_subscription_delete_service(xml, options)
|
502
|
+
xml.tag! 'paySubscriptionDeleteService', {'run' => 'true'}
|
503
|
+
end
|
504
|
+
|
467
505
|
def add_subscription(xml, options, payment_source=nil)
|
468
506
|
if payment_source
|
469
507
|
xml.tag! 'subscription' do
|
@@ -500,7 +538,7 @@ module ActiveMerchant #:nodoc:
|
|
500
538
|
end
|
501
539
|
end
|
502
540
|
xml.tag! 's:Body', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
|
503
|
-
xml.tag! 'requestMessage', {'xmlns' => 'urn:schemas-cybersource-com:transaction-data-1.
|
541
|
+
xml.tag! 'requestMessage', {'xmlns' => 'urn:schemas-cybersource-com:transaction-data-1.51'} do
|
504
542
|
add_merchant_data(xml, options)
|
505
543
|
xml << body
|
506
544
|
end
|
@@ -510,20 +548,6 @@ module ActiveMerchant #:nodoc:
|
|
510
548
|
end
|
511
549
|
|
512
550
|
# Contact CyberSource, make the SOAP request, and parse the reply into a Response object
|
513
|
-
def commit(request, options)
|
514
|
-
response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, build_request(request, options)))
|
515
|
-
success = response[:decision] == "ACCEPT"
|
516
|
-
message = @@response_codes[('r' + response[:reasonCode]).to_sym] rescue response[:message]
|
517
|
-
authorization = success ? [ options[:order_id], response[:requestID], response[:requestToken] ].compact.join(";") : nil
|
518
|
-
|
519
|
-
Response.new(success, message, response,
|
520
|
-
:test => test?,
|
521
|
-
:authorization => authorization,
|
522
|
-
:avs_result => { :code => response[:avsCode] },
|
523
|
-
:cvv_result => response[:cvCode]
|
524
|
-
)
|
525
|
-
end
|
526
|
-
|
527
551
|
def commit(request, options)
|
528
552
|
request = build_request(request, options)
|
529
553
|
response = ssl_post(test? ? TEST_URL : LIVE_URL, request)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: johnreitano-activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 5
|
10
|
+
version: 1.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Reitano
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain:
|
17
17
|
- gem-public_cert.pem
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-28 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|