killbill-cybersource 5.2.2 → 5.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21ecb47153e68552f7be2f25bd3ffc4111bc6a7f
4
- data.tar.gz: ca291457d76c358fea6d8238b2e979c9c92fb0b8
3
+ metadata.gz: 4a0f66b1be2e4f95e93428e32d1a61b6ca8207f0
4
+ data.tar.gz: 888dcf081e39d5e6d13e0044b78ea9afc0f870a0
5
5
  SHA512:
6
- metadata.gz: e9ad96018675914664388cd51df27e1a382cd5d4ffc42ffbcfd253a1d3b2eee1a53a51b1b237f56c17a0a5994dcfb67a7fa721d59588be91e46cb1e8b9fdbe04
7
- data.tar.gz: d88052cde5079e698e1fb69834475d310e520279f4570fc821770215d8e4258bfef98039da37fd03b22e066083a6ee1cfc43e29149538454f3a1adbd03ffe53c
6
+ metadata.gz: 372d6cc47136c1a1247b4d39d9beef29a6890d8d8e6c44f5cd4bf46f406bee3b9a6122790908bd9fb7eec0fa7253c35d36aff24a199564a4833c545ea36f762b
7
+ data.tar.gz: 1dd86f782606fa561fb0f0a9eca82ae34d31507aefd1d8b5002b5502c71c1145975c7d2a69185b3bd1ca55377fcf841a6df0b1bc5f660dd97ec29cad60cc11e4
@@ -32,6 +32,7 @@ module Killbill #:nodoc:
32
32
 
33
33
  add_required_options(kb_account_id, properties, options, context)
34
34
  add_merchant_descriptor(:AUTHORIZE, properties, options)
35
+ add_reconciliation_id(properties, options)
35
36
 
36
37
  properties = merge_properties(properties, options)
37
38
  auth_response = super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
@@ -54,6 +55,7 @@ module Killbill #:nodoc:
54
55
 
55
56
  add_required_options(kb_account_id, properties, options, context)
56
57
  add_merchant_descriptor(:CAPTURE, properties, options)
58
+ add_reconciliation_id(properties, options)
57
59
 
58
60
  properties = merge_properties(properties, options)
59
61
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
@@ -84,6 +86,7 @@ module Killbill #:nodoc:
84
86
  options = {}
85
87
 
86
88
  add_required_options(kb_account_id, properties, options, context)
89
+ add_reconciliation_id(properties, options)
87
90
 
88
91
  properties = merge_properties(properties, options)
89
92
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
@@ -389,6 +392,11 @@ module Killbill #:nodoc:
389
392
  options[:merchant_descriptor] = merchant_descriptor_hash
390
393
  end
391
394
 
395
+ def add_reconciliation_id(properties, options)
396
+ reconciliation_id = find_value_from_properties(properties, 'reconciliation_id')
397
+ options[:reconciliation_id] = reconciliation_id if reconciliation_id.present?
398
+ end
399
+
392
400
  def get_report_api(options, context)
393
401
  return nil if options[:skip_gw] || options[:bypass_duplicate_check]
394
402
  cybersource_config = config(context.tenant_id)[:cybersource]
@@ -4,6 +4,7 @@ module ActiveMerchant
4
4
  KB_PLUGIN_VERSION = Gem.loaded_specs['killbill-cybersource'].version.version rescue nil
5
5
 
6
6
  class CyberSourceGateway
7
+ # The payload definitions: https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.109.xsd
7
8
 
8
9
  def self.x_request_id
9
10
  # See KillbillMDCInsertingServletFilter
@@ -38,6 +39,7 @@ module ActiveMerchant
38
39
  xml.tag! 'ccAuthService', {'run' => 'true'} do
39
40
  # Let CyberSource figure it out otherwise (internet is the default unless tokens are used)
40
41
  xml.tag!("commerceIndicator", options[:commerce_indicator]) unless options[:commerce_indicator].blank?
42
+ add_reconciliation_id(xml, options)
41
43
  end
42
44
  end
43
45
  end
@@ -55,6 +57,7 @@ module ActiveMerchant
55
57
  xml.tag!("cavv", payment_method.payment_cryptogram)
56
58
  xml.tag!("commerceIndicator", options[:commerce_indicator] || (is_android_pay(payment_method, options) ? 'internet' : 'vbv'))
57
59
  xml.tag!("xid", payment_method.payment_cryptogram)
60
+ add_reconciliation_id(xml, options)
58
61
  end
59
62
  when :master
60
63
  xml.tag! 'ucaf' do
@@ -63,6 +66,7 @@ module ActiveMerchant
63
66
  end
64
67
  xml.tag! 'ccAuthService', {'run' => 'true'} do
65
68
  xml.tag!("commerceIndicator", options[:commerce_indicator] || "spa")
69
+ add_reconciliation_id(xml, options)
66
70
  end
67
71
  when :american_express
68
72
  cryptogram = Base64.decode64(payment_method.payment_cryptogram)
@@ -72,10 +76,49 @@ module ActiveMerchant
72
76
  if cryptogram.size == 40
73
77
  xml.tag!("xid", Base64.encode64(cryptogram[20...40]))
74
78
  end
79
+ add_reconciliation_id(xml, options)
75
80
  end
76
81
  end
77
82
  end
78
83
 
84
+ def build_capture_request(money, authorization, options)
85
+ order_id, request_id, request_token = authorization.split(";")
86
+ options[:order_id] = order_id
87
+
88
+ xml = Builder::XmlMarkup.new :indent => 2
89
+ add_purchase_data(xml, money, true, options)
90
+ add_capture_service(xml, request_id, request_token, options)
91
+ add_business_rules_data(xml, authorization, options)
92
+ xml.target!
93
+ end
94
+
95
+ def add_capture_service(xml, request_id, request_token, options = {})
96
+ xml.tag! 'ccCaptureService', {'run' => 'true'} do
97
+ xml.tag! 'authRequestID', request_id
98
+ add_reconciliation_id(xml, options) # the order is important
99
+ xml.tag! 'authRequestToken', request_token
100
+ end
101
+ end
102
+
103
+ def build_refund_request(money, identification, options)
104
+ order_id, request_id, request_token = identification.split(";")
105
+ options[:order_id] = order_id
106
+
107
+ xml = Builder::XmlMarkup.new :indent => 2
108
+ add_purchase_data(xml, money, true, options)
109
+ add_credit_service(xml, request_id, request_token, options)
110
+
111
+ xml.target!
112
+ end
113
+
114
+ def add_credit_service(xml, request_id = nil, request_token = nil, options = {})
115
+ xml.tag! 'ccCreditService', {'run' => 'true'} do
116
+ xml.tag! 'captureRequestID', request_id if request_id
117
+ add_reconciliation_id(xml, options)
118
+ xml.tag! 'captureRequestToken', request_token if request_token
119
+ end
120
+ end
121
+
79
122
  # Changes:
80
123
  # * http://apps.cybersource.com/library/documentation/dev_guides/Android_Pay_SO_API/html/wwhelp/wwhimpl/js/html/wwhelp.htm#href=ch_soAPI.html
81
124
  # * add paymentSolution tag to support Android Pay
@@ -132,6 +175,7 @@ module ActiveMerchant
132
175
  response.delete(k)
133
176
  end
134
177
  end
178
+ response[:reconciliation_id] = options[:reconciliation_id] if options[:reconciliation_id].present?
135
179
 
136
180
  success = response[:decision] == 'ACCEPT'
137
181
  authorization = success ? [options[:order_id], response[:requestID], response[:requestToken]].compact.join(';') : nil
@@ -203,6 +247,11 @@ module ActiveMerchant
203
247
  end
204
248
  end
205
249
 
250
+ def add_reconciliation_id(xml, options)
251
+ return unless options[:reconciliation_id].present?
252
+ xml.tag! 'reconciliationID', options[:reconciliation_id]
253
+ end
254
+
206
255
  def parse_element(reply, node)
207
256
  if node.has_elements?
208
257
  node.elements.each { |e| parse_element(reply, e) }
@@ -37,7 +37,7 @@ module Killbill #:nodoc:
37
37
  :params_cv_code => extract(response, 'cvCode'),
38
38
  :params_authorized_date_time => extract(response, 'authorizedDateTime'),
39
39
  :params_processor_response => extract(response, 'processorResponse'),
40
- :params_reconciliation_id => extract(response, 'reconciliationID'),
40
+ :params_reconciliation_id => extract(response, 'reconciliationID') || extract(response, 'reconciliation_id'), # when failure, use passed-in reconciliation id
41
41
  :params_subscription_id => extract(response, 'subscriptionID'),
42
42
  }
43
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-cybersource
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.2
4
+ version: 5.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement