killbill-orbital 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0246e52421f678aac05af018f70157971f62ffb3
4
- data.tar.gz: f1fb2cc211ffc46616195db66253f54aedd12537
3
+ metadata.gz: 8efed2b0601af3cbb14301f68d36ba9f50cc4af9
4
+ data.tar.gz: ff6ca75f4ec26f2c859962db2212cb3a48d0a5d5
5
5
  SHA512:
6
- metadata.gz: af6ed6a3c6b85f773c762d96912ff56cf838441fd71cea1591c1631821117e22b50ff92f83f3ef3ccb3829595784d31d3e2877cffeff7ef11ddff7a1b0c674f4
7
- data.tar.gz: 6185071f0ec0c15aabf4d508c89d78b87b7e014182daaec8fb4a95300daeac9d3b709b05bef4c80ec1fbb97df58abb5d38230e5480b0ef89258b2f3610a05c37
6
+ metadata.gz: c51ae342210515154d0a8bc87c4173323c36e3acf437cd1c0402d643cb96ac900fd0319b58e95370baf1cbdd51e377070bc541efdc4a3a426b383f0697a5ffe6
7
+ data.tar.gz: c3c80535bc7375ee4a40885498a841dc271e4b571f96cdc5d252de75f3677c8b875fb34c01b86cc15f9dfcecdf3e7a2c5663dd2e19554e5c2c3eeeb31c1fe142
data/lib/orbital/api.rb CHANGED
@@ -28,9 +28,8 @@ module Killbill #:nodoc:
28
28
  end
29
29
 
30
30
  def authorize_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
31
- # Pass extra parameters for the gateway here
32
- options = {}
33
-
31
+ options = {:mit_reference_trx_id => find_mit_ref_trx_id_if_needed(find_value_from_properties(properties, :mit_ref_trx_id),
32
+ context.tenant_id)}
34
33
  properties = merge_properties(properties, options)
35
34
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, with_trace_num_and_order_id(properties))
36
35
  end
@@ -51,9 +50,8 @@ module Killbill #:nodoc:
51
50
  end
52
51
 
53
52
  def purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
54
- # Pass extra parameters for the gateway here
55
- options = {}
56
-
53
+ options = {:mit_reference_trx_id => find_mit_ref_trx_id_if_needed(find_value_from_properties(properties, :mit_ref_trx_id),
54
+ context.tenant_id)}
57
55
  properties = merge_properties(properties, options)
58
56
  super(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, with_trace_num_and_order_id(properties))
59
57
  end
@@ -221,6 +219,10 @@ module Killbill #:nodoc:
221
219
  :params_order_id => find_value_from_properties(properties, :order_id)}.delete_if{|_, value| value.blank?}
222
220
  end
223
221
 
222
+ def find_mit_ref_trx_id_if_needed(ref_trx_id, tenant_id)
223
+ return nil if ref_trx_id.nil?
224
+ return @response_model.send('find_mit_transaction_ref_id', ref_trx_id, tenant_id)
225
+ end
224
226
  end
225
227
  end
226
228
  end
@@ -5,7 +5,7 @@ module ActiveMerchant
5
5
 
6
6
  class OrbitalGateway
7
7
 
8
- API_VERSION = '7.0.1'
8
+ API_VERSION = '7.5'
9
9
 
10
10
  def store(creditcard, options = {})
11
11
  response = add_customer_profile(creditcard, options)
@@ -39,7 +39,7 @@ module ActiveMerchant
39
39
  headers = POST_HEADERS.merge('Content-length' => order.size.to_s,
40
40
  'User-Agent' => user_agent,
41
41
  'Interface-Version' => 'Ruby|KillBill|Open-Source Gateway',
42
- 'Content-Type' => 'application/PTI70')
42
+ 'Content-Type' => 'application/PTI74')
43
43
  headers['X-Request-Id'] = x_r_id unless x_r_id.blank?
44
44
  headers.merge!('Trace-number' => trace_number.to_s,
45
45
  'Merchant-Id' => @options[:merchant_id]) if trace_number
@@ -102,11 +102,13 @@ module ActiveMerchant
102
102
 
103
103
  set_recurring_ind(xml, parameters)
104
104
 
105
- # Append Transaction Reference Number at the end for Refund transactions
105
+ # Append Transaction Reference Number for Refund transactions
106
106
  if action == REFUND && !parameters[:authorization].nil?
107
107
  tx_ref_num, _ = split_authorization(parameters[:authorization])
108
108
  xml.tag! :TxRefNum, tx_ref_num
109
109
  end
110
+
111
+ add_mit_cit_params(xml, parameters)
110
112
  end
111
113
  end
112
114
  xml.target!
@@ -169,6 +171,14 @@ module ActiveMerchant
169
171
  end
170
172
  end
171
173
 
174
+ def add_mit_cit_params(xml, options)
175
+ xml.tag! :MITMsgType, options[:mit_cit_type] unless options[:mit_cit_type].nil?
176
+ unless options[:credential_on_file].nil?
177
+ xml.tag! :MITStoredCredentialInd, (options[:credential_on_file] ? 'Y' : 'N')
178
+ end
179
+ xml.tag! :MITSubmittedTransactionID, options[:mit_reference_trx_id] unless options[:mit_reference_trx_id].nil?
180
+ end
181
+
172
182
  def add_creditcard(xml, creditcard, options = {})
173
183
  currency = options[:currency]
174
184
  cvv_indicator_visa_discover = options[:cvv_indicator_visa_discover]
@@ -77,6 +77,7 @@ module Killbill #:nodoc:
77
77
  :params_terminal_id => extract(response, 'terminal_id'),
78
78
  :params_tx_ref_idx => extract(response, 'tx_ref_idx'),
79
79
  :params_tx_ref_num => extract(response, 'tx_ref_num'),
80
+ :params_mit_received_transaction_id => extract(response, 'mit_received_transaction_id')
80
81
  }
81
82
  end
82
83
 
@@ -155,6 +156,13 @@ module Killbill #:nodoc:
155
156
  where(:kb_payment_id => kb_payment_id, :kb_tenant_id => kb_tenant_id, :api_call => 'authorize').order(:created_at)
156
157
  end
157
158
 
159
+ def self.find_mit_transaction_ref_id(kb_transaction_id, kb_tenant_id)
160
+ last_response = where(:kb_payment_transaction_id => kb_transaction_id, :kb_tenant_id => kb_tenant_id).order(:created_at).last
161
+ return nil if last_response.nil?
162
+
163
+ return last_response.params_mit_received_transaction_id
164
+ end
165
+
158
166
  def gateway_error_code
159
167
  params_resp_code
160
168
  end
@@ -164,6 +172,7 @@ module Killbill #:nodoc:
164
172
  t_info_plugin.properties << create_plugin_property('processorResponse', params_host_resp_code)
165
173
  t_info_plugin.properties << create_plugin_property('orbital_response_id', id)
166
174
  t_info_plugin.properties << create_plugin_property('trace_number', params_trace_number)
175
+ t_info_plugin.properties << create_plugin_property('mit_received_transaction_id', params_mit_received_transaction_id)
167
176
  t_info_plugin
168
177
  end
169
178
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-orbital
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
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: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement