activemerchant 1.84.0 → 1.85.0

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: 4602e2af4d4ec3329ce11f1576662b177dd71504
4
- data.tar.gz: 8d66a22aa55c1e7b78dbcad4673e230e6ee3425f
3
+ metadata.gz: f3fdd27bb50be46ff07917a7dc873c045912fa92
4
+ data.tar.gz: 04d786332b1047ddc974bc53a989c656b79d9856
5
5
  SHA512:
6
- metadata.gz: 395ec9d80c88f8d49501e1a06aa9d7035f161bffec4ac6946729fad84efc87c3f2b28b2d185cfb9e2c69013c84477f7922a9413047e7ef2582fddd443c176749
7
- data.tar.gz: ada93899bf3c38c65e6d28f516f6093690a764077d50d4d6d76b6e80e5097370dbcf7f44c876460ea4cadeb3e70ba1fbd9283d7466f193dd66fb92372542e5e8
6
+ metadata.gz: 40f01dbedce7566d83da6aa05a068d3b93f86264905e5a34fc50ea08b90952f9cb9bf1206f045c3e76f369bf6012d4975047b74fac577f551108c37ab27e91b4
7
+ data.tar.gz: dae3bf98f0c4d86885ba4f9e0fd84c218ea9b84be55e1ca21a0eedb98596bd6ae3b19b1d695338c5bc8f29b616fe184ac58e486b16ac1ac874552e5538085c40
data/CHANGELOG CHANGED
@@ -1,6 +1,8 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
3
  == HEAD
4
+ == Version 1.85.0 (September 28, 2018)
5
+ * Authorize.Net: Support custom delimiter for cim [curiousepic] [#3001]
4
6
 
5
7
  == Version 1.84.0 (September 27, 2018)
6
8
  * PayU Latam: support partial captures [bpollack] #2974
@@ -101,7 +101,7 @@ module ActiveMerchant
101
101
 
102
102
  def purchase(amount, payment, options = {})
103
103
  if payment.is_a?(String)
104
- commit(:cim_purchase) do |xml|
104
+ commit(:cim_purchase, options) do |xml|
105
105
  add_cim_auth_purchase(xml, 'profileTransAuthCapture', amount, payment, options)
106
106
  end
107
107
  else
@@ -113,7 +113,7 @@ module ActiveMerchant
113
113
 
114
114
  def authorize(amount, payment, options={})
115
115
  if payment.is_a?(String)
116
- commit(:cim_authorize) do |xml|
116
+ commit(:cim_authorize, options) do |xml|
117
117
  add_cim_auth_purchase(xml, 'profileTransAuthOnly', amount, payment, options)
118
118
  end
119
119
  else
@@ -273,10 +273,11 @@ module ActiveMerchant
273
273
  add_tax_exempt_status(xml, options)
274
274
  end
275
275
  end
276
+ add_extra_options_for_cim(xml, options)
276
277
  end
277
278
 
278
279
  def cim_capture(amount, authorization, options)
279
- commit(:cim_capture) do |xml|
280
+ commit(:cim_capture, options) do |xml|
280
281
  add_order_id(xml, options)
281
282
  xml.transaction do
282
283
  xml.profileTransPriorAuthCapture do
@@ -287,6 +288,7 @@ module ActiveMerchant
287
288
  xml.transId(transaction_id_from(authorization))
288
289
  end
289
290
  end
291
+ add_extra_options_for_cim(xml, options)
290
292
  end
291
293
  end
292
294
 
@@ -311,7 +313,7 @@ module ActiveMerchant
311
313
  def cim_refund(amount, authorization, options)
312
314
  transaction_id, card_number, _ = split_authorization(authorization)
313
315
 
314
- commit(:cim_refund) do |xml|
316
+ commit(:cim_refund, options) do |xml|
315
317
  add_order_id(xml, options)
316
318
  xml.transaction do
317
319
  xml.profileTransRefund do
@@ -324,6 +326,7 @@ module ActiveMerchant
324
326
  xml.transId(transaction_id)
325
327
  end
326
328
  end
329
+ add_extra_options_for_cim(xml, options)
327
330
  end
328
331
  end
329
332
 
@@ -355,13 +358,14 @@ module ActiveMerchant
355
358
  end
356
359
 
357
360
  def cim_void(authorization, options)
358
- commit(:cim_void) do |xml|
361
+ commit(:cim_void, options) do |xml|
359
362
  add_order_id(xml, options)
360
363
  xml.transaction do
361
364
  xml.profileTransVoid do
362
365
  xml.transId(transaction_id_from(authorization))
363
366
  end
364
367
  end
368
+ add_extra_options_for_cim(xml, options)
365
369
  end
366
370
  end
367
371
 
@@ -672,8 +676,12 @@ module ActiveMerchant
672
676
  xml.poNumber(options[:po_number]) if options[:po_number]
673
677
  end
674
678
 
679
+ def add_extra_options_for_cim(xml, options)
680
+ xml.extraOptions("x_delim_char=#{options[:delimiter]}") if options[:delimiter]
681
+ end
682
+
675
683
  def create_customer_payment_profile(credit_card, options)
676
- commit(:cim_store_update) do |xml|
684
+ commit(:cim_store_update, options) do |xml|
677
685
  xml.customerProfileId options[:customer_profile_id]
678
686
  xml.paymentProfile do
679
687
  add_billing_address(xml, credit_card, options)
@@ -689,7 +697,7 @@ module ActiveMerchant
689
697
  end
690
698
 
691
699
  def create_customer_profile(credit_card, options)
692
- commit(:cim_store) do |xml|
700
+ commit(:cim_store, options) do |xml|
693
701
  xml.profile do
694
702
  xml.merchantCustomerId(truncate(options[:merchant_customer_id], 20) || SecureRandom.hex(10))
695
703
  xml.description(truncate(options[:description], 255)) unless empty?(options[:description])
@@ -712,7 +720,7 @@ module ActiveMerchant
712
720
  end
713
721
 
714
722
  def delete_customer_profile(customer_profile_id)
715
- commit(:cim_store_delete_customer) do |xml|
723
+ commit(:cim_store_delete_customer, options) do |xml|
716
724
  xml.customerProfileId(customer_profile_id)
717
725
  end
718
726
  end
@@ -742,17 +750,17 @@ module ActiveMerchant
742
750
  test? ? test_url : live_url
743
751
  end
744
752
 
745
- def parse(action, raw_response)
753
+ def parse(action, raw_response, options = {})
746
754
  if is_cim_action?(action) || action == :verify_credentials
747
- parse_cim(raw_response)
755
+ parse_cim(raw_response, options)
748
756
  else
749
757
  parse_normal(action, raw_response)
750
758
  end
751
759
  end
752
760
 
753
- def commit(action, &payload)
761
+ def commit(action, options = {}, &payload)
754
762
  raw_response = ssl_post(url, post_data(action, &payload), headers)
755
- response = parse(action, raw_response)
763
+ response = parse(action, raw_response, options)
756
764
 
757
765
  avs_result_code = response[:avs_result_code].upcase if response[:avs_result_code]
758
766
  avs_result = AVSResult.new(code: STANDARD_AVS_CODE_MAPPING[avs_result_code])
@@ -869,7 +877,7 @@ module ActiveMerchant
869
877
  response
870
878
  end
871
879
 
872
- def parse_cim(body)
880
+ def parse_cim(body, options)
873
881
  response = {}
874
882
 
875
883
  doc = Nokogiri::XML(body).remove_namespaces!
@@ -904,7 +912,7 @@ module ActiveMerchant
904
912
  (empty?(element.content) ? nil : element.content)
905
913
  end
906
914
 
907
- response.merge!(parse_direct_response_elements(response))
915
+ response.merge!(parse_direct_response_elements(response, options))
908
916
 
909
917
  response
910
918
  end
@@ -967,11 +975,11 @@ module ActiveMerchant
967
975
  action && is_cim_action?(action)
968
976
  end
969
977
 
970
- def parse_direct_response_elements(response)
978
+ def parse_direct_response_elements(response, options)
971
979
  params = response[:direct_response]
972
980
  return {} unless params
973
981
 
974
- parts = params.split(',')
982
+ parts = params.split(options[:delimiter] || ',')
975
983
  {
976
984
  response_code: parts[0].to_i,
977
985
  response_subcode: parts[1],
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.84.0'
2
+ VERSION = '1.85.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.84.0
4
+ version: 1.85.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport