lib/active_merchant/billing/gateways/qvalent.rb in activemerchant-1.90.0 vs lib/active_merchant/billing/gateways/qvalent.rb in activemerchant-1.91.0
- old
+ new
@@ -10,10 +10,14 @@
self.supported_countries = ['AU']
self.default_currency = 'AUD'
self.money_format = :cents
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners]
+ CVV_CODE_MAPPING = {
+ 'S' => 'D'
+ }
+
def initialize(options={})
requires!(options, :username, :password, :merchant, :pem, :pem_password)
super
end
@@ -166,12 +170,19 @@
Response.new(
succeeded,
message_from(succeeded, raw),
raw,
authorization: raw['response.orderNumber'] || raw['response.customerReferenceNumber'],
+ cvv_result: cvv_result(succeeded, raw),
error_code: error_code_from(succeeded, raw),
test: test?
)
+ end
+
+ def cvv_result(succeeded, raw)
+ return unless succeeded
+ code = CVV_CODE_MAPPING[raw['response.cvnResponse']] || raw['response.cvnResponse']
+ CVVResult.new(code)
end
def headers
{
'Content-Type' => 'application/x-www-form-urlencoded'