lib/active_merchant/billing/gateways/paybox_direct.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/paybox_direct.rb in activemerchant-1.116.0
- old
+ new
@@ -62,23 +62,45 @@
def initialize(options = {})
requires!(options, :login, :password)
super
end
+ def add_3dsecure(post, options)
+ # ECI=02 => MasterCard success
+ # ECI=05 => Visa, Amex or JCB success
+ if options[:eci] == '02' || options[:eci] == '05'
+ post[:"3DSTATUS"] = 'Y'
+ post[:"3DENROLLED"] = 'Y'
+ post[:"3DSIGNVAL"] = 'Y'
+ post[:"3DERROR"] = '0'
+ else
+ post[:"3DSTATUS"] = 'N'
+ post[:"3DENROLLED"] = 'N'
+ post[:"3DSIGNVAL"] = 'N'
+ post[:"3DERROR"] = '10000'
+ end
+ post[:"3DECI"] = options[:eci]
+ post[:"3DXID"] = options[:xid]
+ post[:"3DCAVV"] = options[:cavv]
+ post[:"3DCAVVALGO"] = options[:cavv_algorithm]
+ end
+
def authorize(money, creditcard, options = {})
post = {}
add_invoice(post, options)
add_creditcard(post, creditcard)
+ add_3dsecure(post, options[:three_d_secure]) if options[:three_d_secure]
add_amount(post, money, options)
commit('authorization', money, post)
end
def purchase(money, creditcard, options = {})
post = {}
add_invoice(post, options)
add_creditcard(post, creditcard)
+ add_3dsecure(post, options[:three_d_secure]) if options[:three_d_secure]
add_amount(post, money, options)
commit('purchase', money, post)
end
@@ -158,10 +180,10 @@
message_from(response),
response.merge(timestamp: parameters[:dateq]),
test: test?,
authorization: response[:numappel].to_s + response[:numtrans].to_s,
fraud_review: false,
- sent_params: parameters.delete_if { |key, value| %w[porteur dateval cvv].include?(key.to_s) }
+ sent_params: parameters.delete_if { |key, _value| %w[porteur dateval cvv].include?(key.to_s) }
)
end
def success?(response)
SUCCESS_CODES.include?(response[:codereponse])