activemerchant 1.125.0 → 1.126.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +75 -0
  3. data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
  4. data/lib/active_merchant/billing/gateway.rb +2 -1
  5. data/lib/active_merchant/billing/gateways/adyen.rb +7 -4
  6. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  7. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +2 -1
  8. data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -21
  10. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +6 -1
  11. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  12. data/lib/active_merchant/billing/gateways/braintree_blue.rb +87 -15
  13. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/checkout_v2.rb +1 -1
  15. data/lib/active_merchant/billing/gateways/credorax.rb +10 -0
  16. data/lib/active_merchant/billing/gateways/cyber_source.rb +13 -33
  17. data/lib/active_merchant/billing/gateways/d_local.rb +49 -0
  18. data/lib/active_merchant/billing/gateways/decidir.rb +17 -1
  19. data/lib/active_merchant/billing/gateways/decidir_plus.rb +185 -14
  20. data/lib/active_merchant/billing/gateways/ebanx.rb +3 -2
  21. data/lib/active_merchant/billing/gateways/global_collect.rb +26 -16
  22. data/lib/active_merchant/billing/gateways/ipg.rb +1 -2
  23. data/lib/active_merchant/billing/gateways/litle.rb +93 -1
  24. data/lib/active_merchant/billing/gateways/moneris.rb +35 -8
  25. data/lib/active_merchant/billing/gateways/nmi.rb +12 -7
  26. data/lib/active_merchant/billing/gateways/orbital.rb +349 -327
  27. data/lib/active_merchant/billing/gateways/payflow.rb +62 -0
  28. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -7
  29. data/lib/active_merchant/billing/gateways/paysafe.rb +15 -15
  30. data/lib/active_merchant/billing/gateways/payu_latam.rb +25 -15
  31. data/lib/active_merchant/billing/gateways/priority.rb +158 -136
  32. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  33. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -4
  34. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  35. data/lib/active_merchant/billing/gateways/stripe.rb +4 -2
  36. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +93 -48
  37. data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -2
  38. data/lib/active_merchant/version.rb +1 -1
  39. metadata +6 -2
@@ -203,40 +203,25 @@ module ActiveMerchant #:nodoc:
203
203
  # ECP for Orbital requires $0 prenotes so ensure
204
204
  # if we are doing a force capture with a check, that
205
205
  # we do a purchase here
206
- if options[:force_capture] && payment_source.is_a?(Check) &&
207
- (options[:action_code].include?('W8') || options[:action_code].include?('W9') || options[:action_code].include?('ND'))
208
- return purchase(money, payment_source, options)
209
- end
206
+ return purchase(money, payment_source, options) if force_capture_with_echeck?(payment_source, options)
207
+
208
+ order = build_new_auth_purchase_order(AUTH_ONLY, money, payment_source, options)
210
209
 
211
- order = build_new_order_xml(AUTH_ONLY, money, payment_source, options) do |xml|
212
- add_payment_source(xml, payment_source, options)
213
- add_address(xml, payment_source, options)
214
- if @options[:customer_profiles]
215
- add_customer_data(xml, payment_source, options)
216
- add_managed_billing(xml, options)
217
- end
218
- end
219
210
  commit(order, :authorize, options[:retry_logic], options[:trace_number])
220
211
  end
221
212
 
222
- def verify(creditcard, options = {})
223
- amount = allow_0_auth?(creditcard) ? 0 : 100
213
+ def verify(credit_card, options = {})
214
+ amount = options[:verify_amount] ? options[:verify_amount].to_i : default_verify_amount(credit_card)
224
215
  MultiResponse.run(:use_first_response) do |r|
225
- r.process { authorize(amount, creditcard, options) }
226
- r.process(:ignore_result) { void(r.authorization) }
216
+ r.process { authorize(amount, credit_card, options) }
217
+ r.process(:ignore_result) { void(r.authorization) } unless amount == 0
227
218
  end
228
219
  end
229
220
 
230
221
  # AC – Authorization and Capture
231
222
  def purchase(money, payment_source, options = {})
232
- order = build_new_order_xml(options[:force_capture] ? FORCE_AUTH_AND_CAPTURE : AUTH_AND_CAPTURE, money, payment_source, options) do |xml|
233
- add_payment_source(xml, payment_source, options)
234
- add_address(xml, payment_source, options)
235
- if @options[:customer_profiles]
236
- add_customer_data(xml, payment_source, options)
237
- add_managed_billing(xml, options)
238
- end
239
- end
223
+ action = options[:force_capture] ? FORCE_AUTH_AND_CAPTURE : AUTH_AND_CAPTURE
224
+ order = build_new_auth_purchase_order(action, money, payment_source, options)
240
225
 
241
226
  commit(order, :purchase, options[:retry_logic], options[:trace_number])
242
227
  end
@@ -253,10 +238,11 @@ module ActiveMerchant #:nodoc:
253
238
  if payment_method.is_a?(Check)
254
239
  add_echeck(xml, payment_method, options)
255
240
  else
256
- add_refund(xml, options[:currency])
241
+ add_refund_payment_source(xml, options[:currency])
257
242
  end
258
243
  xml.tag! :CustomerRefNum, options[:customer_ref_num] if @options[:customer_profiles] && options[:profile_txn]
259
244
  end
245
+
260
246
  commit(order, :refund, options[:retry_logic], options[:trace_number])
261
247
  end
262
248
 
@@ -264,6 +250,7 @@ module ActiveMerchant #:nodoc:
264
250
  order = build_new_order_xml(REFUND, money, payment_method, options) do |xml|
265
251
  add_payment_source(xml, payment_method, options)
266
252
  end
253
+
267
254
  commit(order, :refund, options[:retry_logic], options[:trace_number])
268
255
  end
269
256
 
@@ -274,10 +261,15 @@ module ActiveMerchant #:nodoc:
274
261
  end
275
262
 
276
263
  order = build_void_request_xml(authorization, options)
264
+
277
265
  commit(order, :void, options[:retry_logic], options[:trace_number])
278
266
  end
279
267
 
280
- def allow_0_auth?(credit_card)
268
+ def default_verify_amount(credit_card)
269
+ allow_zero_auth?(credit_card) ? 0 : 100
270
+ end
271
+
272
+ def allow_zero_auth?(credit_card)
281
273
  # Discover does not support a $0.00 authorization instead use $1.00
282
274
  %w(visa master american_express diners_club jcb).include?(credit_card.brand)
283
275
  end
@@ -303,15 +295,15 @@ module ActiveMerchant #:nodoc:
303
295
  # 'I' - Inactive
304
296
  # 'MS' - Manual Suspend
305
297
 
306
- def add_customer_profile(creditcard, options = {})
298
+ def add_customer_profile(credit_card, options = {})
307
299
  options[:customer_profile_action] = CREATE
308
- order = build_customer_request_xml(creditcard, options)
300
+ order = build_customer_request_xml(credit_card, options)
309
301
  commit(order, :add_customer_profile)
310
302
  end
311
303
 
312
- def update_customer_profile(creditcard, options = {})
304
+ def update_customer_profile(credit_card, options = {})
313
305
  options[:customer_profile_action] = UPDATE
314
- order = build_customer_request_xml(creditcard, options)
306
+ order = build_customer_request_xml(credit_card, options)
315
307
  commit(order, :update_customer_profile)
316
308
  end
317
309
 
@@ -327,6 +319,10 @@ module ActiveMerchant #:nodoc:
327
319
  commit(order, :delete_customer_profile)
328
320
  end
329
321
 
322
+ def supports_network_tokenization?
323
+ true
324
+ end
325
+
330
326
  def supports_scrubbing?
331
327
  true
332
328
  end
@@ -349,6 +345,42 @@ module ActiveMerchant #:nodoc:
349
345
 
350
346
  private
351
347
 
348
+ def force_capture_with_echeck?(payment_source, options)
349
+ return false unless options[:force_capture]
350
+ return false unless payment_source.is_a?(Check)
351
+
352
+ %w(W8 W9 ND).include?(options[:action_code])
353
+ end
354
+
355
+ #=====REFERENCE FIELDS=====
356
+
357
+ def add_customer_data(xml, credit_card, options)
358
+ add_customer_ref_num(xml, options)
359
+
360
+ return if options[:profile_txn]
361
+
362
+ xml.tag! :CustomerProfileFromOrderInd, profile_number(options) if add_profile_number?(options, credit_card)
363
+ xml.tag! :CustomerProfileOrderOverrideInd, options[:customer_profile_order_override_ind] || NO_MAPPING_TO_ORDER_DATA
364
+ end
365
+
366
+ def add_profile_number?(options, credit_card)
367
+ return true unless options[:customer_ref_num] && credit_card.nil?
368
+ end
369
+
370
+ def profile_number(options)
371
+ options[:customer_ref_num] ? USE_CUSTOMER_REF_NUM : AUTO_GENERATE
372
+ end
373
+
374
+ def add_customer_ref_num(xml, options)
375
+ xml.tag! :CustomerRefNum, options[:customer_ref_num] if options[:customer_ref_num]
376
+ end
377
+
378
+ def add_tx_ref_num(xml, authorization)
379
+ return unless authorization
380
+
381
+ xml.tag! :TxRefNum, split_authorization(authorization).first
382
+ end
383
+
352
384
  def authorization_string(*args)
353
385
  args.compact.join(';')
354
386
  end
@@ -357,21 +389,16 @@ module ActiveMerchant #:nodoc:
357
389
  authorization.split(';')
358
390
  end
359
391
 
360
- def add_customer_data(xml, creditcard, options)
361
- if options[:profile_txn]
362
- xml.tag! :CustomerRefNum, options[:customer_ref_num]
363
- else
364
- if options[:customer_ref_num]
365
- xml.tag! :CustomerProfileFromOrderInd, USE_CUSTOMER_REF_NUM if creditcard
366
- xml.tag! :CustomerRefNum, options[:customer_ref_num]
367
- else
368
- xml.tag! :CustomerProfileFromOrderInd, AUTO_GENERATE
369
- end
370
- xml.tag! :CustomerProfileOrderOverrideInd, options[:customer_profile_order_override_ind] || NO_MAPPING_TO_ORDER_DATA
371
- end
392
+ #=====DESCRIPTOR FIELDS=====
393
+
394
+ def add_soft_descriptors(xml, descriptors)
395
+ return unless descriptors
396
+
397
+ add_soft_descriptors_from_specialized_class(xml, descriptors) if descriptors.is_a?(OrbitalSoftDescriptors)
398
+ add_soft_descriptors_from_hash(xml, descriptors) if descriptors.is_a?(Hash)
372
399
  end
373
400
 
374
- def add_soft_descriptors(xml, soft_desc)
401
+ def add_soft_descriptors_from_specialized_class(xml, soft_desc)
375
402
  xml.tag! :SDMerchantName, soft_desc.merchant_name if soft_desc.merchant_name
376
403
  xml.tag! :SDProductDescription, soft_desc.product_description if soft_desc.product_description
377
404
  xml.tag! :SDMerchantCity, soft_desc.merchant_city if soft_desc.merchant_city
@@ -455,31 +482,52 @@ module ActiveMerchant #:nodoc:
455
482
  end
456
483
  end
457
484
 
458
- def add_card_indicators(xml, options)
459
- xml.tag! :CardIndicators, options[:card_indicators] if options[:card_indicators]
460
- end
485
+ #=====ADDRESS FIELDS=====
461
486
 
462
487
  def add_address(xml, payment_source, options)
463
- address = get_address(options)
464
-
465
- unless address.blank?
466
- avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s) || empty?(address[:country])
467
-
468
- if avs_supported
469
- xml.tag! :AVSzip, byte_limit(format_address_field(address[:zip]), 10)
470
- xml.tag! :AVSaddress1, byte_limit(format_address_field(address[:address1]), 30)
471
- xml.tag! :AVSaddress2, byte_limit(format_address_field(address[:address2]), 30)
472
- xml.tag! :AVScity, byte_limit(format_address_field(address[:city]), 20)
473
- xml.tag! :AVSstate, byte_limit(format_address_field(address[:state]), 2)
474
- xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
475
- end
488
+ return unless (address = get_address(options))
489
+
490
+ if avs_supported?(address[:country]) || empty?(address[:country])
491
+ xml.tag! :AVSzip, byte_limit(format_address_field(address[:zip]), 10)
492
+ xml.tag! :AVSaddress1, byte_limit(format_address_field(address[:address1]), 30)
493
+ xml.tag! :AVSaddress2, byte_limit(format_address_field(address[:address2]), 30)
494
+ xml.tag! :AVScity, byte_limit(format_address_field(address[:city]), 20)
495
+ xml.tag! :AVSstate, byte_limit(format_address_field(address[:state]), 2)
496
+ xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
497
+ end
476
498
 
477
- xml.tag! :AVSname, billing_name(payment_source, options)
478
- xml.tag! :AVScountryCode, (avs_supported ? byte_limit(format_address_field(address[:country]), 2) : '')
499
+ xml.tag! :AVSname, billing_name(payment_source, options)
500
+ xml.tag! :AVScountryCode, byte_limit(format_address_field(filter_unsupported_countries(address[:country])), 2)
479
501
 
480
- # Needs to come after AVScountryCode
481
- add_destination_address(xml, address) if avs_supported
482
- end
502
+ # Needs to come after AVScountryCode
503
+ add_destination_address(xml, address) if avs_supported?(address[:country]) || empty?(address[:country])
504
+ end
505
+
506
+ def add_destination_address(xml, address)
507
+ return unless address[:dest_zip]
508
+
509
+ xml.tag! :AVSDestzip, byte_limit(format_address_field(address[:dest_zip]), 10)
510
+ xml.tag! :AVSDestaddress1, byte_limit(format_address_field(address[:dest_address1]), 30)
511
+ xml.tag! :AVSDestaddress2, byte_limit(format_address_field(address[:dest_address2]), 30)
512
+ xml.tag! :AVSDestcity, byte_limit(format_address_field(address[:dest_city]), 20)
513
+ xml.tag! :AVSDeststate, byte_limit(format_address_field(address[:dest_state]), 2)
514
+ xml.tag! :AVSDestphoneNum, (address[:dest_phone] ? address[:dest_phone].scan(/\d/).join.to_s[0..13] : nil)
515
+ xml.tag! :AVSDestname, byte_limit(address[:dest_name], 30)
516
+ xml.tag! :AVSDestcountryCode, filter_unsupported_countries(address[:dest_country])
517
+ end
518
+
519
+ # For Profile requests
520
+ def add_customer_address(xml, options)
521
+ return unless (address = get_address(options))
522
+
523
+ xml.tag! :CustomerAddress1, byte_limit(format_address_field(address[:address1]), 30)
524
+ xml.tag! :CustomerAddress2, byte_limit(format_address_field(address[:address2]), 30)
525
+ xml.tag! :CustomerCity, byte_limit(format_address_field(address[:city]), 20)
526
+ xml.tag! :CustomerState, byte_limit(format_address_field(address[:state]), 2)
527
+ xml.tag! :CustomerZIP, byte_limit(format_address_field(address[:zip]), 10)
528
+ xml.tag! :CustomerEmail, byte_limit(address[:email], 50) if address[:email]
529
+ xml.tag! :CustomerPhone, (address[:phone] ? address[:phone].scan(/\d/).join.to_s : nil)
530
+ xml.tag! :CustomerCountryCode, filter_unsupported_countries(address[:country])
483
531
  end
484
532
 
485
533
  def billing_name(payment_source, options)
@@ -490,80 +538,53 @@ module ActiveMerchant #:nodoc:
490
538
  end
491
539
  end
492
540
 
493
- def add_destination_address(xml, address)
494
- if address[:dest_zip]
495
- avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:dest_country].to_s)
496
-
497
- xml.tag! :AVSDestzip, byte_limit(format_address_field(address[:dest_zip]), 10)
498
- xml.tag! :AVSDestaddress1, byte_limit(format_address_field(address[:dest_address1]), 30)
499
- xml.tag! :AVSDestaddress2, byte_limit(format_address_field(address[:dest_address2]), 30)
500
- xml.tag! :AVSDestcity, byte_limit(format_address_field(address[:dest_city]), 20)
501
- xml.tag! :AVSDeststate, byte_limit(format_address_field(address[:dest_state]), 2)
502
- xml.tag! :AVSDestphoneNum, (address[:dest_phone] ? address[:dest_phone].scan(/\d/).join.to_s[0..13] : nil)
503
-
504
- xml.tag! :AVSDestname, byte_limit(address[:dest_name], 30)
505
- xml.tag! :AVSDestcountryCode, (avs_supported ? address[:dest_country] : '')
506
- end
541
+ def avs_supported?(address)
542
+ AVS_SUPPORTED_COUNTRIES.include?(address.to_s)
507
543
  end
508
544
 
509
- # For Profile requests
510
- def add_customer_address(xml, options)
511
- address = get_address(options)
512
-
513
- unless address.blank?
514
- avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s)
515
-
516
- xml.tag! :CustomerAddress1, byte_limit(format_address_field(address[:address1]), 30)
517
- xml.tag! :CustomerAddress2, byte_limit(format_address_field(address[:address2]), 30)
518
- xml.tag! :CustomerCity, byte_limit(format_address_field(address[:city]), 20)
519
- xml.tag! :CustomerState, byte_limit(format_address_field(address[:state]), 2)
520
- xml.tag! :CustomerZIP, byte_limit(format_address_field(address[:zip]), 10)
521
- xml.tag! :CustomerEmail, byte_limit(address[:email], 50) if address[:email]
522
- xml.tag! :CustomerPhone, (address[:phone] ? address[:phone].scan(/\d/).join.to_s : nil)
523
- xml.tag! :CustomerCountryCode, (avs_supported ? address[:country] : '')
524
- end
545
+ def filter_unsupported_countries(address)
546
+ avs_supported?(address) ? address.to_s : ''
547
+ end
548
+
549
+ def get_address(options)
550
+ options[:billing_address] || options[:address]
525
551
  end
526
552
 
553
+ #=====PAYMENT SOURCE FIELDS=====
554
+
527
555
  # Payment can be done through either Credit Card or Electronic Check
528
556
  def add_payment_source(xml, payment_source, options = {})
529
- if payment_source.is_a?(Check)
530
- add_echeck(xml, payment_source, options)
531
- else
532
- add_creditcard(xml, payment_source, options[:currency])
533
- end
557
+ payment_source.is_a?(Check) ? add_echeck(xml, payment_source, options) : add_credit_card(xml, payment_source, options)
534
558
  end
535
559
 
536
- # Adds Electronic Check attributes
537
560
  def add_echeck(xml, check, options = {})
561
+ return unless check
562
+
538
563
  xml.tag! :CardBrand, 'EC'
539
- xml.tag! :CurrencyCode, currency_code(options[:currency])
540
- xml.tag! :CurrencyExponent, currency_exponents(options[:currency])
541
- unless check.nil?
564
+ add_currency_fields(xml, options[:currency])
565
+ xml.tag! :BCRtNum, check.routing_number
566
+ xml.tag! :CheckDDA, check.account_number if check.account_number
567
+ xml.tag! :BankAccountType, ACCOUNT_TYPE[check.account_type] if ACCOUNT_TYPE[check.account_type]
568
+ xml.tag! :ECPAuthMethod, options[:auth_method] if options[:auth_method]
569
+ xml.tag! :BankPmtDelv, options[:payment_delivery] || 'B'
570
+ xml.tag! :AVSname, (check&.name ? check.name[0..29] : nil) if get_address(options).blank?
571
+ end
542
572
 
543
- xml.tag! :BCRtNum, check.routing_number
544
- xml.tag! :CheckDDA, check.account_number if check.account_number
545
- xml.tag! :BankAccountType, ACCOUNT_TYPE[check.account_type] if ACCOUNT_TYPE[check.account_type]
546
- xml.tag! :ECPAuthMethod, options[:auth_method] if options[:auth_method]
573
+ def add_credit_card(xml, credit_card, options)
574
+ xml.tag! :AccountNum, credit_card.number if credit_card
575
+ xml.tag! :Exp, expiry_date(credit_card) if credit_card
576
+ add_currency_fields(xml, options[:currency])
577
+ add_verification_value(xml, credit_card) if credit_card
578
+ end
547
579
 
548
- if options[:payment_delivery]
549
- xml.tag! :BankPmtDelv, options[:payment_delivery]
550
- else
551
- xml.tag! :BankPmtDelv, 'B'
552
- end
580
+ def add_refund_payment_source(xml, currency = nil)
581
+ xml.tag! :AccountNum, nil
553
582
 
554
- xml.tag! :AVSname, (check&.name ? check.name[0..29] : nil) if get_address(options).blank?
555
- end
583
+ add_currency_fields(xml, currency)
556
584
  end
557
585
 
558
- # Adds Credit Card attributes
559
- def add_creditcard(xml, creditcard, currency = nil)
560
- unless creditcard.nil?
561
- xml.tag! :AccountNum, creditcard.number
562
- xml.tag! :Exp, expiry_date(creditcard)
563
- end
564
-
565
- xml.tag! :CurrencyCode, currency_code(currency)
566
- xml.tag! :CurrencyExponent, currency_exponents(currency)
586
+ def add_verification_value(xml, credit_card)
587
+ return unless credit_card&.verification_value?
567
588
 
568
589
  # If you are trying to collect a Card Verification Number
569
590
  # (CardSecVal) for a Visa or Discover transaction, pass one of these values:
@@ -574,131 +595,209 @@ module ActiveMerchant #:nodoc:
574
595
  # Null-fill this attribute OR
575
596
  # Do not submit the attribute at all.
576
597
  # - http://download.chasepaymentech.com/docs/orbital/orbital_gateway_xml_specification.pdf
577
- unless creditcard.nil?
578
- if creditcard.verification_value?
579
- xml.tag! :CardSecValInd, '1' if %w(visa master discover).include?(creditcard.brand)
580
- xml.tag! :CardSecVal, creditcard.verification_value
581
- end
582
- end
598
+ xml.tag! :CardSecValInd, '1' if %w(visa master discover).include?(credit_card.brand)
599
+ xml.tag! :CardSecVal, credit_card.verification_value
583
600
  end
584
601
 
585
- def add_eci(xml, creditcard, three_d_secure)
586
- eci = if three_d_secure
587
- three_d_secure[:eci]
588
- elsif creditcard.is_a?(NetworkTokenizationCreditCard)
589
- creditcard.eci
590
- end
602
+ def add_currency_fields(xml, currency)
603
+ xml.tag! :CurrencyCode, currency_code(currency)
604
+ xml.tag! :CurrencyExponent, currency_exponents(currency)
605
+ end
591
606
 
592
- xml.tag!(:AuthenticationECIInd, eci) if eci
607
+ def add_card_indicators(xml, options)
608
+ xml.tag! :CardIndicators, options[:card_indicators] if options[:card_indicators]
593
609
  end
594
610
 
595
- def add_xid(xml, creditcard, three_d_secure)
596
- return unless three_d_secure && creditcard.brand == 'visa'
611
+ def currency_code(currency)
612
+ CURRENCY_CODES[(currency || self.default_currency)].to_s
613
+ end
597
614
 
598
- xml.tag!(:XID, three_d_secure[:xid]) if three_d_secure[:xid]
615
+ def currency_exponents(currency)
616
+ CURRENCY_EXPONENTS[(currency || self.default_currency)].to_s
617
+ end
618
+
619
+ def expiry_date(credit_card)
620
+ "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
621
+ end
622
+
623
+ def bin
624
+ @options[:bin] || (salem_mid? ? '000001' : '000002')
625
+ end
626
+
627
+ def salem_mid?
628
+ @options[:merchant_id].length == 6
599
629
  end
600
630
 
601
- def add_cavv(xml, creditcard, three_d_secure)
602
- return unless three_d_secure && creditcard.brand == 'visa'
631
+ #=====BRAND-SPECIFIC FIELDS=====
632
+
633
+ def add_cavv(xml, credit_card, three_d_secure)
634
+ return unless three_d_secure && credit_card.brand == 'visa'
603
635
 
604
636
  xml.tag!(:CAVV, three_d_secure[:cavv])
605
637
  end
606
638
 
607
- def add_aav(xml, creditcard, three_d_secure)
608
- return unless three_d_secure && creditcard.brand == 'master'
639
+ def add_aav(xml, credit_card, three_d_secure)
640
+ return unless three_d_secure && credit_card.brand == 'master'
609
641
 
610
642
  xml.tag!(:AAV, three_d_secure[:cavv])
611
643
  end
612
644
 
613
- def add_mc_program_protocol(xml, creditcard, three_d_secure)
614
- return unless three_d_secure && creditcard.brand == 'master'
615
- return unless three_d_secure[:version]
645
+ def add_aevv(xml, credit_card, three_d_secure)
646
+ return unless three_d_secure && credit_card.brand == 'american_express'
616
647
 
617
- truncated_version = three_d_secure[:version].to_s[0]
618
- xml.tag!(:MCProgramProtocol, truncated_version)
648
+ xml.tag!(:AEVV, three_d_secure[:cavv])
619
649
  end
620
650
 
621
- def add_mc_directory_trans_id(xml, creditcard, three_d_secure)
622
- return unless three_d_secure && creditcard.brand == 'master'
651
+ def add_xid(xml, credit_card, three_d_secure)
652
+ return unless three_d_secure && credit_card.brand == 'visa'
623
653
 
624
- xml.tag!(:MCDirectoryTransID, three_d_secure[:ds_transaction_id]) if three_d_secure[:ds_transaction_id]
654
+ xml.tag!(:XID, three_d_secure[:xid]) if three_d_secure[:xid]
625
655
  end
626
656
 
627
- def add_mc_ucafind(xml, creditcard, three_d_secure)
628
- return unless three_d_secure && creditcard.brand == 'master'
657
+ def add_pymt_brand_program_code(xml, credit_card, three_d_secure)
658
+ return unless three_d_secure && credit_card.brand == 'american_express'
629
659
 
630
- xml.tag! :UCAFInd, '4'
660
+ xml.tag!(:PymtBrandProgramCode, 'ASK')
661
+ end
662
+
663
+ def mastercard?(payment_source)
664
+ payment_source.is_a?(CreditCard) && payment_source.brand == 'master'
631
665
  end
632
666
 
633
- def add_mc_scarecurring(xml, creditcard, parameters, three_d_secure)
634
- return unless parameters && parameters[:sca_recurring] && creditcard.brand == 'master'
667
+ def add_mastercard_fields(xml, credit_card, parameters, three_d_secure)
668
+ add_mc_sca_merchant_initiated(xml, credit_card, parameters, three_d_secure)
669
+ add_mc_sca_recurring(xml, credit_card, parameters, three_d_secure)
670
+ add_mc_program_protocol(xml, credit_card, three_d_secure)
671
+ add_mc_directory_trans_id(xml, credit_card, three_d_secure)
672
+ add_mc_ucafind(xml, credit_card, three_d_secure)
673
+ end
635
674
 
636
- valid_eci = three_d_secure && three_d_secure[:eci] && three_d_secure[:eci] == '7'
675
+ def add_mc_sca_merchant_initiated(xml, credit_card, parameters, three_d_secure)
676
+ return unless parameters.try(:[], :sca_merchant_initiated)
677
+ return unless three_d_secure.try(:[], :eci) == '7'
637
678
 
638
- xml.tag!(:SCARecurringPayment, parameters[:sca_recurring]) if valid_eci
679
+ xml.tag!(:SCAMerchantInitiatedTransaction, parameters[:sca_merchant_initiated])
639
680
  end
640
681
 
641
- def add_mc_sca_merchant_initiated(xml, creditcard, parameters, three_d_secure)
642
- return unless parameters && parameters[:sca_merchant_initiated] && creditcard.brand == 'master'
682
+ def add_mc_sca_recurring(xml, credit_card, parameters, three_d_secure)
683
+ return unless parameters.try(:[], :sca_recurring)
684
+ return unless three_d_secure.try(:[], :eci) == '7'
643
685
 
644
- valid_eci = three_d_secure && three_d_secure[:eci] && three_d_secure[:eci] == '7'
686
+ xml.tag!(:SCARecurringPayment, parameters[:sca_recurring])
687
+ end
645
688
 
646
- xml.tag!(:SCAMerchantInitiatedTransaction, parameters[:sca_merchant_initiated]) if valid_eci
689
+ def add_mc_program_protocol(xml, credit_card, three_d_secure)
690
+ return unless version = three_d_secure.try(:[], :version)
691
+
692
+ xml.tag!(:MCProgramProtocol, version.to_s[0])
647
693
  end
648
694
 
649
- def add_dpanind(xml, creditcard)
650
- return unless creditcard.is_a?(NetworkTokenizationCreditCard)
695
+ def add_mc_directory_trans_id(xml, credit_card, three_d_secure)
696
+ return unless three_d_secure
651
697
 
652
- xml.tag! :DPANInd, 'Y'
698
+ xml.tag!(:MCDirectoryTransID, three_d_secure[:ds_transaction_id]) if three_d_secure[:ds_transaction_id]
653
699
  end
654
700
 
655
- def add_digital_token_cryptogram(xml, creditcard)
656
- return unless creditcard.is_a?(NetworkTokenizationCreditCard)
701
+ def add_mc_ucafind(xml, credit_card, three_d_secure)
702
+ return unless three_d_secure
657
703
 
658
- xml.tag! :DigitalTokenCryptogram, creditcard.payment_cryptogram
704
+ xml.tag! :UCAFInd, '4'
659
705
  end
660
706
 
661
- def add_aevv(xml, creditcard, three_d_secure)
662
- return unless three_d_secure && creditcard.brand == 'american_express'
707
+ #=====SCA (STORED CREDENTIAL) FIELDS=====
663
708
 
664
- xml.tag!(:AEVV, three_d_secure[:cavv])
709
+ def add_stored_credentials(xml, parameters)
710
+ return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)
711
+
712
+ if msg_type = get_msg_type(parameters)
713
+ xml.tag! :MITMsgType, msg_type
714
+ end
715
+ xml.tag! :MITStoredCredentialInd, 'Y'
716
+ if parameters[:mit_submitted_transaction_id]
717
+ xml.tag! :MITSubmittedTransactionID, parameters[:mit_submitted_transaction_id]
718
+ elsif parameters.dig(:stored_credential, :network_transaction_id) && parameters.dig(:stored_credential, :initiator) == 'merchant'
719
+ xml.tag! :MITSubmittedTransactionID, parameters[:stored_credential][:network_transaction_id]
720
+ end
665
721
  end
666
722
 
667
- def add_pymt_brand_program_code(xml, creditcard, three_d_secure)
668
- return unless three_d_secure && creditcard.brand == 'american_express'
723
+ def get_msg_type(parameters)
724
+ return parameters[:mit_msg_type] if parameters[:mit_msg_type]
725
+ return 'CSTO' if parameters[:stored_credential][:initial_transaction]
726
+ return unless parameters[:stored_credential][:initiator] && parameters[:stored_credential][:reason_type]
669
727
 
670
- xml.tag!(:PymtBrandProgramCode, 'ASK')
728
+ initiator =
729
+ case parameters[:stored_credential][:initiator]
730
+ when 'cardholder', 'customer' then 'C'
731
+ when 'merchant' then 'M'
732
+ end
733
+ reason =
734
+ case parameters[:stored_credential][:reason_type]
735
+ when 'recurring' then 'REC'
736
+ when 'installment' then 'INS'
737
+ when 'unscheduled' then 'USE'
738
+ end
739
+
740
+ "#{initiator}#{reason}"
671
741
  end
672
742
 
673
- def add_refund(xml, currency = nil)
674
- xml.tag! :AccountNum, nil
743
+ #=====NETWORK TOKENIZATION FIELDS=====
675
744
 
676
- xml.tag! :CurrencyCode, currency_code(currency)
677
- xml.tag! :CurrencyExponent, currency_exponents(currency)
745
+ def add_eci(xml, credit_card, three_d_secure)
746
+ eci = if three_d_secure
747
+ three_d_secure[:eci]
748
+ elsif credit_card.is_a?(NetworkTokenizationCreditCard)
749
+ credit_card.eci
750
+ end
751
+
752
+ xml.tag!(:AuthenticationECIInd, eci) if eci
753
+ end
754
+
755
+ def add_dpanind(xml, credit_card)
756
+ return unless credit_card.is_a?(NetworkTokenizationCreditCard)
757
+
758
+ xml.tag! :DPANInd, 'Y'
759
+ end
760
+
761
+ def add_digital_token_cryptogram(xml, credit_card)
762
+ return unless credit_card.is_a?(NetworkTokenizationCreditCard)
763
+
764
+ xml.tag! :DigitalTokenCryptogram, credit_card.payment_cryptogram
765
+ end
766
+
767
+ #=====OTHER FIELDS=====
768
+
769
+ # For Canadian transactions on PNS Tampa on New Order
770
+ # RF - First Recurring Transaction
771
+ # RS - Subsequent Recurring Transactions
772
+ def set_recurring_ind(xml, parameters)
773
+ return unless parameters[:recurring_ind]
774
+ raise 'RecurringInd must be set to either "RF" or "RS"' unless %w(RF RS).include?(parameters[:recurring_ind])
775
+
776
+ xml.tag! :RecurringInd, parameters[:recurring_ind]
678
777
  end
679
778
 
680
779
  def add_managed_billing(xml, options)
681
- if mb = options[:managed_billing]
682
- ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
683
-
684
- # default to recurring (R). Other option is deferred (D).
685
- xml.tag! :MBType, mb[:type] || RECURRING
686
- # default to Customer Reference Number
687
- xml.tag! :MBOrderIdGenerationMethod, mb[:order_id_generation_method] || 'IO'
688
- # By default use MBRecurringEndDate, set to N.
689
- # MMDDYYYY
690
- xml.tag! :MBRecurringStartDate, mb[:start_date].scan(/\d/).join.to_s if mb[:start_date]
691
- # MMDDYYYY
692
- xml.tag! :MBRecurringEndDate, mb[:end_date].scan(/\d/).join.to_s if mb[:end_date]
693
- # By default listen to any value set in MBRecurringEndDate.
694
- xml.tag! :MBRecurringNoEndDateFlag, mb[:no_end_date_flag] || 'N' # 'Y' || 'N' (Yes or No).
695
- xml.tag! :MBRecurringMaxBillings, mb[:max_billings] if mb[:max_billings]
696
- xml.tag! :MBRecurringFrequency, mb[:frequency] if mb[:frequency]
697
- xml.tag! :MBDeferredBillDate, mb[:deferred_bill_date] if mb[:deferred_bill_date]
698
- xml.tag! :MBMicroPaymentMaxDollarValue, mb[:max_dollar_value] if mb[:max_dollar_value]
699
- xml.tag! :MBMicroPaymentMaxBillingDays, mb[:max_billing_days] if mb[:max_billing_days]
700
- xml.tag! :MBMicroPaymentMaxTransactions, mb[:max_transactions] if mb[:max_transactions]
701
- end
780
+ return unless mb = options[:managed_billing]
781
+
782
+ ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
783
+
784
+ # default to recurring (R). Other option is deferred (D).
785
+ xml.tag! :MBType, mb[:type] || RECURRING
786
+ # default to Customer Reference Number
787
+ xml.tag! :MBOrderIdGenerationMethod, mb[:order_id_generation_method] || 'IO'
788
+ # By default use MBRecurringEndDate, set to N.
789
+ # MMDDYYYY
790
+ xml.tag! :MBRecurringStartDate, mb[:start_date].scan(/\d/).join.to_s if mb[:start_date]
791
+ # MMDDYYYY
792
+ xml.tag! :MBRecurringEndDate, mb[:end_date].scan(/\d/).join.to_s if mb[:end_date]
793
+ # By default listen to any value set in MBRecurringEndDate.
794
+ xml.tag! :MBRecurringNoEndDateFlag, mb[:no_end_date_flag] || 'N' # 'Y' || 'N' (Yes or No).
795
+ xml.tag! :MBRecurringMaxBillings, mb[:max_billings] if mb[:max_billings]
796
+ xml.tag! :MBRecurringFrequency, mb[:frequency] if mb[:frequency]
797
+ xml.tag! :MBDeferredBillDate, mb[:deferred_bill_date] if mb[:deferred_bill_date]
798
+ xml.tag! :MBMicroPaymentMaxDollarValue, mb[:max_dollar_value] if mb[:max_dollar_value]
799
+ xml.tag! :MBMicroPaymentMaxBillingDays, mb[:max_billing_days] if mb[:max_billing_days]
800
+ xml.tag! :MBMicroPaymentMaxTransactions, mb[:max_transactions] if mb[:max_transactions]
702
801
  end
703
802
 
704
803
  def add_ews_details(xml, payment_source, parameters = {})
@@ -737,61 +836,20 @@ module ActiveMerchant #:nodoc:
737
836
  end
738
837
  end
739
838
 
740
- def add_stored_credentials(xml, parameters)
741
- return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)
742
-
743
- if msg_type = get_msg_type(parameters)
744
- xml.tag! :MITMsgType, msg_type
745
- end
746
- xml.tag! :MITStoredCredentialInd, 'Y'
747
- if parameters[:mit_submitted_transaction_id]
748
- xml.tag! :MITSubmittedTransactionID, parameters[:mit_submitted_transaction_id]
749
- elsif parameters.dig(:stored_credential, :network_transaction_id) && parameters.dig(:stored_credential, :initiator) == 'merchant'
750
- xml.tag! :MITSubmittedTransactionID, parameters[:stored_credential][:network_transaction_id]
839
+ def add_xml_credentials(xml)
840
+ unless ip_authentication?
841
+ xml.tag! :OrbitalConnectionUsername, @options[:login]
842
+ xml.tag! :OrbitalConnectionPassword, @options[:password]
751
843
  end
752
844
  end
753
845
 
754
- def get_msg_type(parameters)
755
- return parameters[:mit_msg_type] if parameters[:mit_msg_type]
756
- return 'CSTO' if parameters[:stored_credential][:initial_transaction]
757
- return unless parameters[:stored_credential][:initiator] && parameters[:stored_credential][:reason_type]
758
-
759
- initiator =
760
- case parameters[:stored_credential][:initiator]
761
- when 'cardholder', 'customer' then 'C'
762
- when 'merchant' then 'M'
763
- end
764
- reason =
765
- case parameters[:stored_credential][:reason_type]
766
- when 'recurring' then 'REC'
767
- when 'installment' then 'INS'
768
- when 'unscheduled' then 'USE'
769
- end
770
-
771
- "#{initiator}#{reason}"
772
- end
773
-
774
- def parse(body)
775
- response = {}
776
- xml = REXML::Document.new(strip_invalid_xml_chars(body))
777
- root = REXML::XPath.first(xml, '//Response') ||
778
- REXML::XPath.first(xml, '//ErrorResponse')
779
- if root
780
- root.elements.to_a.each do |node|
781
- recurring_parse_element(response, node)
782
- end
783
- end
784
-
785
- response.delete_if { |k, _| SENSITIVE_FIELDS.include?(k) }
846
+ def add_bin_merchant_and_terminal(xml, parameters)
847
+ xml.tag! :BIN, bin
848
+ xml.tag! :MerchantID, @options[:merchant_id]
849
+ xml.tag! :TerminalID, parameters[:terminal_id] || '001'
786
850
  end
787
851
 
788
- def recurring_parse_element(response, node)
789
- if node.has_elements?
790
- node.elements.each { |e| recurring_parse_element(response, e) }
791
- else
792
- response[node.name.underscore.to_sym] = node.text
793
- end
794
- end
852
+ #=====REQUEST/RESPONSE METHODS=====
795
853
 
796
854
  def commit(order, message_type, retry_logic = nil, trace_number = nil)
797
855
  headers = POST_HEADERS.merge('Content-length' => order.size.to_s)
@@ -826,6 +884,28 @@ module ActiveMerchant #:nodoc:
826
884
  end
827
885
  end
828
886
 
887
+ def parse(body)
888
+ response = {}
889
+ xml = REXML::Document.new(strip_invalid_xml_chars(body))
890
+ root = REXML::XPath.first(xml, '//Response') ||
891
+ REXML::XPath.first(xml, '//ErrorResponse')
892
+ if root
893
+ root.elements.to_a.each do |node|
894
+ recurring_parse_element(response, node)
895
+ end
896
+ end
897
+
898
+ response.delete_if { |k, _| SENSITIVE_FIELDS.include?(k) }
899
+ end
900
+
901
+ def recurring_parse_element(response, node)
902
+ if node.has_elements?
903
+ node.elements.each { |e| recurring_parse_element(response, e) }
904
+ else
905
+ response[node.name.underscore.to_sym] = node.text
906
+ end
907
+ end
908
+
829
909
  def success?(response, message_type)
830
910
  if %i[void].include?(message_type)
831
911
  response[:proc_status] == SUCCESS
@@ -847,24 +927,26 @@ module ActiveMerchant #:nodoc:
847
927
  @options[:ip_authentication] == true
848
928
  end
849
929
 
930
+ #=====BUILDER METHODS=====
931
+
932
+ def build_new_auth_purchase_order(action, money, payment_source, options)
933
+ build_new_order_xml(action, money, payment_source, options) do |xml|
934
+ add_payment_source(xml, payment_source, options)
935
+ add_address(xml, payment_source, options)
936
+ if @options[:customer_profiles]
937
+ add_customer_data(xml, payment_source, options)
938
+ add_managed_billing(xml, options)
939
+ end
940
+ end
941
+ end
942
+
850
943
  def build_new_order_xml(action, money, payment_source, parameters = {})
851
944
  requires!(parameters, :order_id)
852
945
  xml = xml_envelope
853
946
  xml.tag! :Request do
854
947
  xml.tag! :NewOrder do
855
948
  add_xml_credentials(xml)
856
- # EC - Ecommerce transaction
857
- # RC - Recurring Payment transaction
858
- # MO - Mail Order Telephone Order transaction
859
- # IV - Interactive Voice Response
860
- # IN - Interactive Voice Response
861
949
  xml.tag! :IndustryType, parameters[:industry_type] || ECOMMERCE_TRANSACTION
862
- # A - Auth Only No Capture
863
- # AC - Auth and Capture
864
- # F - Force Auth No Capture and no online authorization
865
- # FR - Force Auth No Capture and no online authorization
866
- # FC - Force Auth and Capture no online authorization
867
- # R - Refund and Capture no online authorization
868
950
  xml.tag! :MessageType, action
869
951
  add_bin_merchant_and_terminal(xml, parameters)
870
952
 
@@ -886,12 +968,7 @@ module ActiveMerchant #:nodoc:
886
968
  add_aav(xml, payment_source, three_d_secure)
887
969
  # CustomerAni, AVSPhoneType and AVSDestPhoneType could be added here.
888
970
 
889
- if parameters[:soft_descriptors].is_a?(OrbitalSoftDescriptors)
890
- add_soft_descriptors(xml, parameters[:soft_descriptors])
891
- elsif parameters[:soft_descriptors].is_a?(Hash)
892
- add_soft_descriptors_from_hash(xml, parameters[:soft_descriptors])
893
- end
894
-
971
+ add_soft_descriptors(xml, parameters[:soft_descriptors])
895
972
  add_dpanind(xml, payment_source)
896
973
  add_aevv(xml, payment_source, three_d_secure)
897
974
  add_digital_token_cryptogram(xml, payment_source)
@@ -901,10 +978,7 @@ module ActiveMerchant #:nodoc:
901
978
  set_recurring_ind(xml, parameters)
902
979
 
903
980
  # Append Transaction Reference Number at the end for Refund transactions
904
- if action == REFUND && parameters[:authorization]
905
- tx_ref_num, = split_authorization(parameters[:authorization])
906
- xml.tag! :TxRefNum, tx_ref_num
907
- end
981
+ add_tx_ref_num(xml, parameters[:authorization]) if action == REFUND
908
982
 
909
983
  add_level2_purchase(xml, parameters)
910
984
  add_level3_purchase(xml, parameters)
@@ -914,27 +988,12 @@ module ActiveMerchant #:nodoc:
914
988
  add_card_indicators(xml, parameters)
915
989
  add_stored_credentials(xml, parameters)
916
990
  add_pymt_brand_program_code(xml, payment_source, three_d_secure)
917
- add_mc_sca_merchant_initiated(xml, payment_source, parameters, three_d_secure)
918
- add_mc_scarecurring(xml, payment_source, parameters, three_d_secure)
919
- add_mc_program_protocol(xml, payment_source, three_d_secure)
920
- add_mc_directory_trans_id(xml, payment_source, three_d_secure)
921
- add_mc_ucafind(xml, payment_source, three_d_secure)
991
+ add_mastercard_fields(xml, payment_source, parameters, three_d_secure) if mastercard?(payment_source)
922
992
  end
923
993
  end
924
994
  xml.target!
925
995
  end
926
996
 
927
- # For Canadian transactions on PNS Tampa on New Order
928
- # RF - First Recurring Transaction
929
- # RS - Subsequent Recurring Transactions
930
- def set_recurring_ind(xml, parameters)
931
- if parameters[:recurring_ind]
932
- raise 'RecurringInd must be set to either "RF" or "RS"' unless %w(RF RS).include?(parameters[:recurring_ind])
933
-
934
- xml.tag! :RecurringInd, parameters[:recurring_ind]
935
- end
936
- end
937
-
938
997
  def build_mark_for_capture_xml(money, authorization, parameters = {})
939
998
  tx_ref_num, order_id = split_authorization(authorization)
940
999
  xml = xml_envelope
@@ -974,49 +1033,12 @@ module ActiveMerchant #:nodoc:
974
1033
  xml.target!
975
1034
  end
976
1035
 
977
- def currency_code(currency)
978
- CURRENCY_CODES[(currency || self.default_currency)].to_s
979
- end
980
-
981
- def currency_exponents(currency)
982
- CURRENCY_EXPONENTS[(currency || self.default_currency)].to_s
983
- end
984
-
985
- def expiry_date(credit_card)
986
- "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
987
- end
988
-
989
- def bin
990
- @options[:bin] || (salem_mid? ? '000001' : '000002')
991
- end
992
-
993
1036
  def xml_envelope
994
1037
  xml = Builder::XmlMarkup.new(indent: 2)
995
1038
  xml.instruct!(:xml, version: '1.0', encoding: 'UTF-8')
996
1039
  xml
997
1040
  end
998
1041
 
999
- def add_xml_credentials(xml)
1000
- unless ip_authentication?
1001
- xml.tag! :OrbitalConnectionUsername, @options[:login]
1002
- xml.tag! :OrbitalConnectionPassword, @options[:password]
1003
- end
1004
- end
1005
-
1006
- def add_bin_merchant_and_terminal(xml, parameters)
1007
- xml.tag! :BIN, bin
1008
- xml.tag! :MerchantID, @options[:merchant_id]
1009
- xml.tag! :TerminalID, parameters[:terminal_id] || '001'
1010
- end
1011
-
1012
- def salem_mid?
1013
- @options[:merchant_id].length == 6
1014
- end
1015
-
1016
- def get_address(options)
1017
- options[:billing_address] || options[:address]
1018
- end
1019
-
1020
1042
  # Null characters are possible in some responses (namely, the respMsg field), causing XML parsing errors
1021
1043
  # Prevent by substituting these with a valid placeholder string
1022
1044
  def strip_invalid_xml_chars(xml)
@@ -1056,7 +1078,7 @@ module ActiveMerchant #:nodoc:
1056
1078
  limited_value
1057
1079
  end
1058
1080
 
1059
- def build_customer_request_xml(creditcard, options = {})
1081
+ def build_customer_request_xml(credit_card, options = {})
1060
1082
  ActiveMerchant.deprecated 'Customer Profile support in Orbital is non-conformant to the ActiveMerchant API and will be removed in its current form in a future version. Please contact the ActiveMerchant maintainers if you have an interest in modifying it to conform to the store/unstore/update API.'
1061
1083
  xml = xml_envelope
1062
1084
  xml.tag! :Request do
@@ -1065,7 +1087,7 @@ module ActiveMerchant #:nodoc:
1065
1087
  xml.tag! :OrbitalConnectionPassword, @options[:password] unless ip_authentication?
1066
1088
  xml.tag! :CustomerBin, bin
1067
1089
  xml.tag! :CustomerMerchantID, @options[:merchant_id]
1068
- xml.tag! :CustomerName, creditcard.name if creditcard
1090
+ xml.tag! :CustomerName, credit_card.name if credit_card
1069
1091
  xml.tag! :CustomerRefNum, options[:customer_ref_num] if options[:customer_ref_num]
1070
1092
 
1071
1093
  add_customer_address(xml, options)
@@ -1093,8 +1115,8 @@ module ActiveMerchant #:nodoc:
1093
1115
  xml.tag! :Status, options[:status] || ACTIVE # Active
1094
1116
  end
1095
1117
 
1096
- xml.tag! :CCAccountNum, creditcard.number if creditcard
1097
- xml.tag! :CCExpireDate, creditcard.expiry_date.expiration.strftime('%m%y') if creditcard
1118
+ xml.tag! :CCAccountNum, credit_card.number if credit_card
1119
+ xml.tag! :CCExpireDate, credit_card.expiry_date.expiration.strftime('%m%y') if credit_card
1098
1120
 
1099
1121
  # This has to come after CCExpireDate.
1100
1122
  add_managed_billing(xml, options)