lib/processout/transaction.rb in processout-2.10.0 vs lib/processout/transaction.rb in processout-2.11.0

- old
+ new

@@ -35,22 +35,30 @@ attr_reader :refunded_amount_local attr_reader :available_amount attr_reader :available_amount_local attr_reader :currency attr_reader :error_code + attr_reader :gateway_name attr_reader :three_d_s_status attr_reader :status attr_reader :authorized attr_reader :captured + attr_reader :voided + attr_reader :refunded + attr_reader :chargedback + attr_reader :received_fraud_notification + attr_reader :received_retrieval_request attr_reader :processout_fee attr_reader :estimated_fee attr_reader :gateway_fee attr_reader :gateway_fee_local attr_reader :currency_fee attr_reader :metadata attr_reader :sandbox attr_reader :created_at + attr_reader :chargedback_at + attr_reader :refunded_at def id=(val) @id = val end @@ -79,14 +87,14 @@ if val.nil? @invoice = val return end - if val.instance_of? Customer + if val.instance_of? Invoice @invoice = val else - obj = Customer.new(@client) + obj = Invoice.new(@client) obj.fill_with_data(val) @invoice = obj end end @@ -285,10 +293,14 @@ def error_code=(val) @error_code = val end + def gateway_name=(val) + @gateway_name = val + end + def three_d_s_status=(val) @three_d_s_status = val end def status=(val) @@ -301,10 +313,30 @@ def captured=(val) @captured = val end + def voided=(val) + @voided = val + end + + def refunded=(val) + @refunded = val + end + + def chargedback=(val) + @chargedback = val + end + + def received_fraud_notification=(val) + @received_fraud_notification = val + end + + def received_retrieval_request=(val) + @received_retrieval_request = val + end + def processout_fee=(val) @processout_fee = val end def estimated_fee=(val) @@ -333,10 +365,18 @@ def created_at=(val) @created_at = val end + def chargedback_at=(val) + @chargedback_at = val + end + + def refunded_at=(val) + @refunded_at = val + end + # Initializes the Transaction object # Params: # +client+:: +ProcessOut+ client instance # +data+:: data that can be used to fill the object @@ -371,22 +411,30 @@ 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.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) + self.voided = data.fetch(:voided, nil) + self.refunded = data.fetch(:refunded, nil) + self.chargedback = data.fetch(:chargedback, nil) + self.received_fraud_notification = data.fetch(:received_fraud_notification, nil) + self.received_retrieval_request = data.fetch(:received_retrieval_request, nil) self.processout_fee = data.fetch(:processout_fee, nil) self.estimated_fee = data.fetch(:estimated_fee, nil) self.gateway_fee = data.fetch(:gateway_fee, nil) self.gateway_fee_local = data.fetch(:gateway_fee_local, nil) self.currency_fee = data.fetch(:currency_fee, nil) 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) end # Create a new Transaction using the current client def new(data = {}) @@ -488,10 +536,13 @@ self.currency = data["currency"] end if data.include? "error_code" self.error_code = data["error_code"] 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"] end if data.include? "status" self.status = data["status"] @@ -500,10 +551,25 @@ self.authorized = data["authorized"] end if data.include? "captured" self.captured = data["captured"] end + if data.include? "voided" + self.voided = data["voided"] + end + if data.include? "refunded" + self.refunded = data["refunded"] + end + if data.include? "chargedback" + self.chargedback = data["chargedback"] + end + if data.include? "received_fraud_notification" + self.received_fraud_notification = data["received_fraud_notification"] + end + if data.include? "received_retrieval_request" + self.received_retrieval_request = data["received_retrieval_request"] + end if data.include? "processout_fee" self.processout_fee = data["processout_fee"] end if data.include? "estimated_fee" self.estimated_fee = data["estimated_fee"] @@ -524,10 +590,16 @@ self.sandbox = data["sandbox"] end if data.include? "created_at" self.created_at = data["created_at"] end + if data.include? "chargedback_at" + self.chargedback_at = data["chargedback_at"] + end + if data.include? "refunded_at" + self.refunded_at = data["refunded_at"] + end self end # Prefills the object with the data passed as parameters @@ -565,21 +637,29 @@ 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.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) + self.voided = data.fetch(:voided, self.voided) + self.refunded = data.fetch(:refunded, self.refunded) + self.chargedback = data.fetch(:chargedback, self.chargedback) + self.received_fraud_notification = data.fetch(:received_fraud_notification, self.received_fraud_notification) + self.received_retrieval_request = data.fetch(:received_retrieval_request, self.received_retrieval_request) self.processout_fee = data.fetch(:processout_fee, self.processout_fee) self.estimated_fee = data.fetch(:estimated_fee, self.estimated_fee) self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee) self.gateway_fee_local = data.fetch(:gateway_fee_local, self.gateway_fee_local) self.currency_fee = data.fetch(:currency_fee, self.currency_fee) 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 end # Get the transaction's refunds.