lib/processout/transaction.rb in processout-2.14.0 vs lib/processout/transaction.rb in processout-2.14.4
- old
+ new
@@ -36,10 +36,11 @@
attr_reader :refunded_amount_local
attr_reader :available_amount
attr_reader :available_amount_local
attr_reader :currency
attr_reader :error_code
+ attr_reader :error_message
attr_reader :gateway_name
attr_reader :three_d_s_status
attr_reader :status
attr_reader :authorized
attr_reader :captured
@@ -56,10 +57,13 @@
attr_reader :metadata
attr_reader :sandbox
attr_reader :created_at
attr_reader :chargedback_at
attr_reader :refunded_at
+ attr_reader :three_d_s
+ attr_reader :cvc_check
+ attr_reader :avs_check
def id=(val)
@id = val
end
@@ -294,10 +298,14 @@
def error_code=(val)
@error_code = val
end
+ def error_message=(val)
+ @error_message = val
+ end
+
def gateway_name=(val)
@gateway_name = val
end
def three_d_s_status=(val)
@@ -374,11 +382,35 @@
def refunded_at=(val)
@refunded_at = val
end
+ def three_d_s=(val)
+ if val.nil?
+ @three_d_s = val
+ return
+ end
+ if val.instance_of? ThreeDS
+ @three_d_s = val
+ else
+ obj = ThreeDS.new(@client)
+ obj.fill_with_data(val)
+ @three_d_s = obj
+ end
+
+ end
+
+ def cvc_check=(val)
+ @cvc_check = val
+ end
+
+ def avs_check=(val)
+ @avs_check = val
+ end
+
+
# Initializes the Transaction object
# Params:
# +client+:: +ProcessOut+ client instance
# +data+:: data that can be used to fill the object
def initialize(client, data = {})
@@ -412,10 +444,11 @@
self.refunded_amount_local = data.fetch(:refunded_amount_local, nil)
self.available_amount = data.fetch(:available_amount, nil)
self.available_amount_local = data.fetch(:available_amount_local, nil)
self.currency = data.fetch(:currency, nil)
self.error_code = data.fetch(:error_code, nil)
+ self.error_message = data.fetch(:error_message, nil)
self.gateway_name = data.fetch(:gateway_name, nil)
self.three_d_s_status = data.fetch(:three_d_s_status, nil)
self.status = data.fetch(:status, nil)
self.authorized = data.fetch(:authorized, nil)
self.captured = data.fetch(:captured, nil)
@@ -432,10 +465,13 @@
self.metadata = data.fetch(:metadata, nil)
self.sandbox = data.fetch(:sandbox, nil)
self.created_at = data.fetch(:created_at, nil)
self.chargedback_at = data.fetch(:chargedback_at, nil)
self.refunded_at = data.fetch(:refunded_at, nil)
+ self.three_d_s = data.fetch(:three_d_s, nil)
+ self.cvc_check = data.fetch(:cvc_check, nil)
+ self.avs_check = data.fetch(:avs_check, nil)
end
# Create a new Transaction using the current client
def new(data = {})
@@ -473,10 +509,11 @@
"refunded_amount_local": self.refunded_amount_local,
"available_amount": self.available_amount,
"available_amount_local": self.available_amount_local,
"currency": self.currency,
"error_code": self.error_code,
+ "error_message": self.error_message,
"gateway_name": self.gateway_name,
"three_d_s_status": self.three_d_s_status,
"status": self.status,
"authorized": self.authorized,
"captured": self.captured,
@@ -493,10 +530,13 @@
"metadata": self.metadata,
"sandbox": self.sandbox,
"created_at": self.created_at,
"chargedback_at": self.chargedback_at,
"refunded_at": self.refunded_at,
+ "three_d_s": self.three_d_s,
+ "cvc_check": self.cvc_check,
+ "avs_check": self.avs_check,
}.to_json
end
# Fills the object with data coming from the API
# Params:
@@ -593,10 +633,13 @@
self.currency = data["currency"]
end
if data.include? "error_code"
self.error_code = data["error_code"]
end
+ if data.include? "error_message"
+ self.error_message = data["error_message"]
+ end
if data.include? "gateway_name"
self.gateway_name = data["gateway_name"]
end
if data.include? "three_d_s_status"
self.three_d_s_status = data["three_d_s_status"]
@@ -653,10 +696,19 @@
self.chargedback_at = data["chargedback_at"]
end
if data.include? "refunded_at"
self.refunded_at = data["refunded_at"]
end
+ if data.include? "three_d_s"
+ self.three_d_s = data["three_d_s"]
+ end
+ if data.include? "cvc_check"
+ self.cvc_check = data["cvc_check"]
+ end
+ if data.include? "avs_check"
+ self.avs_check = data["avs_check"]
+ end
self
end
# Prefills the object with the data passed as parameters
@@ -694,10 +746,11 @@
self.refunded_amount_local = data.fetch(:refunded_amount_local, self.refunded_amount_local)
self.available_amount = data.fetch(:available_amount, self.available_amount)
self.available_amount_local = data.fetch(:available_amount_local, self.available_amount_local)
self.currency = data.fetch(:currency, self.currency)
self.error_code = data.fetch(:error_code, self.error_code)
+ self.error_message = data.fetch(:error_message, self.error_message)
self.gateway_name = data.fetch(:gateway_name, self.gateway_name)
self.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status)
self.status = data.fetch(:status, self.status)
self.authorized = data.fetch(:authorized, self.authorized)
self.captured = data.fetch(:captured, self.captured)
@@ -714,9 +767,12 @@
self.metadata = data.fetch(:metadata, self.metadata)
self.sandbox = data.fetch(:sandbox, self.sandbox)
self.created_at = data.fetch(:created_at, self.created_at)
self.chargedback_at = data.fetch(:chargedback_at, self.chargedback_at)
self.refunded_at = data.fetch(:refunded_at, self.refunded_at)
+ self.three_d_s = data.fetch(:three_d_s, self.three_d_s)
+ self.cvc_check = data.fetch(:cvc_check, self.cvc_check)
+ self.avs_check = data.fetch(:avs_check, self.avs_check)
self
end
# Get the transaction's refunds.