class ProcessOut::Transaction
Attributes
amount[R]
amount_local[R]
available_amount[R]
available_amount_local[R]
avs_check[R]
captured[R]
captured_amount[R]
captured_amount_local[R]
card[R]
card_id[R]
chargedback[R]
chargedback_at[R]
created_at[R]
currency[R]
currency_fee[R]
customer[R]
customer_id[R]
cvc_check[R]
error_code[R]
error_message[R]
estimated_fee[R]
gateway_configuration[R]
gateway_configuration_id[R]
gateway_fee[R]
gateway_fee_local[R]
gateway_name[R]
id[R]
invoice[R]
invoice_id[R]
metadata[R]
name[R]
operations[R]
processout_fee[R]
project[R]
project_id[R]
received_fraud_notification[R]
received_retrieval_request[R]
refunded[R]
refunded_amount[R]
refunded_amount_local[R]
refunded_at[R]
refunds[R]
sandbox[R]
status[R]
subscription[R]
subscription_id[R]
three_d_s[R]
three_d_s_status[R]
token[R]
token_id[R]
voided[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the Transaction
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/transaction.rb, line 416 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) self.project = data.fetch(:project, nil) self.project_id = data.fetch(:project_id, nil) self.invoice = data.fetch(:invoice, nil) self.invoice_id = data.fetch(:invoice_id, nil) self.customer = data.fetch(:customer, nil) self.customer_id = data.fetch(:customer_id, nil) self.subscription = data.fetch(:subscription, nil) self.subscription_id = data.fetch(:subscription_id, nil) self.token = data.fetch(:token, nil) self.token_id = data.fetch(:token_id, nil) self.card = data.fetch(:card, nil) self.card_id = data.fetch(:card_id, nil) self.gateway_configuration = data.fetch(:gateway_configuration, nil) self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil) self.operations = data.fetch(:operations, nil) self.refunds = data.fetch(:refunds, nil) self.name = data.fetch(:name, nil) self.amount = data.fetch(:amount, nil) self.amount_local = data.fetch(:amount_local, nil) self.authorized_amount = data.fetch(:authorized_amount, nil) self.authorized_amount_local = data.fetch(:authorized_amount_local, nil) self.captured_amount = data.fetch(:captured_amount, nil) self.captured_amount_local = data.fetch(:captured_amount_local, nil) self.refunded_amount = data.fetch(:refunded_amount, nil) 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) 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) 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
Public Instance Methods
all(options = {})
click to toggle source
Get all the transactions. Params:
options
-
Hash
of options
# File lib/processout/transaction.rb, line 837 def all(options = {}) self.prefill(options) request = Request.new(@client) path = "/transactions" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new a = Array.new body = response.body for v in body['transactions'] tmp = Transaction.new(@client) tmp.fill_with_data(v) a.push(tmp) end return_values.push(a) return_values[0] end
amount=(val)
click to toggle source
# File lib/processout/transaction.rb, line 255 def amount=(val) @amount = val end
amount_local=(val)
click to toggle source
# File lib/processout/transaction.rb, line 259 def amount_local=(val) @amount_local = val end
available_amount=(val)
click to toggle source
# File lib/processout/transaction.rb, line 287 def available_amount=(val) @available_amount = val end
available_amount_local=(val)
click to toggle source
# File lib/processout/transaction.rb, line 291 def available_amount_local=(val) @available_amount_local = val end
avs_check=(val)
click to toggle source
# File lib/processout/transaction.rb, line 407 def avs_check=(val) @avs_check = val end
captured=(val)
click to toggle source
# File lib/processout/transaction.rb, line 323 def captured=(val) @captured = val end
captured_amount=(val)
click to toggle source
# File lib/processout/transaction.rb, line 271 def captured_amount=(val) @captured_amount = val end
captured_amount_local=(val)
click to toggle source
# File lib/processout/transaction.rb, line 275 def captured_amount_local=(val) @captured_amount_local = val end
card=(val)
click to toggle source
# File lib/processout/transaction.rb, line 171 def card=(val) if val.nil? @card = val return end if val.instance_of? Card @card = val else obj = Card.new(@client) obj.fill_with_data(val) @card = obj end end
card_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 187 def card_id=(val) @card_id = val end
chargedback=(val)
click to toggle source
# File lib/processout/transaction.rb, line 335 def chargedback=(val) @chargedback = val end
chargedback_at=(val)
click to toggle source
# File lib/processout/transaction.rb, line 379 def chargedback_at=(val) @chargedback_at = val end
created_at=(val)
click to toggle source
# File lib/processout/transaction.rb, line 375 def created_at=(val) @created_at = val end
currency=(val)
click to toggle source
# File lib/processout/transaction.rb, line 295 def currency=(val) @currency = val end
currency_fee=(val)
click to toggle source
# File lib/processout/transaction.rb, line 363 def currency_fee=(val) @currency_fee = val end
customer=(val)
click to toggle source
# File lib/processout/transaction.rb, line 111 def customer=(val) if val.nil? @customer = val return end if val.instance_of? Customer @customer = val else obj = Customer.new(@client) obj.fill_with_data(val) @customer = obj end end
customer_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 127 def customer_id=(val) @customer_id = val end
cvc_check=(val)
click to toggle source
# File lib/processout/transaction.rb, line 403 def cvc_check=(val) @cvc_check = val end
error_code=(val)
click to toggle source
# File lib/processout/transaction.rb, line 299 def error_code=(val) @error_code = val end
error_message=(val)
click to toggle source
# File lib/processout/transaction.rb, line 303 def error_message=(val) @error_message = val end
estimated_fee=(val)
click to toggle source
# File lib/processout/transaction.rb, line 351 def estimated_fee=(val) @estimated_fee = val end
fetch_refunds(options = {})
click to toggle source
Get the transaction's refunds. Params:
options
-
Hash
of options
# File lib/processout/transaction.rb, line 782 def fetch_refunds(options = {}) self.prefill(options) request = Request.new(@client) path = "/transactions/" + CGI.escape(@id) + "/refunds" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new a = Array.new body = response.body for v in body['refunds'] tmp = Refund.new(@client) tmp.fill_with_data(v) a.push(tmp) end return_values.push(a) return_values[0] end
fill_with_data(data)
click to toggle source
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
# File lib/processout/transaction.rb, line 544 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end if data.include? "project" self.project = data["project"] end if data.include? "project_id" self.project_id = data["project_id"] end if data.include? "invoice" self.invoice = data["invoice"] end if data.include? "invoice_id" self.invoice_id = data["invoice_id"] end if data.include? "customer" self.customer = data["customer"] end if data.include? "customer_id" self.customer_id = data["customer_id"] end if data.include? "subscription" self.subscription = data["subscription"] end if data.include? "subscription_id" self.subscription_id = data["subscription_id"] end if data.include? "token" self.token = data["token"] end if data.include? "token_id" self.token_id = data["token_id"] end if data.include? "card" self.card = data["card"] end if data.include? "card_id" self.card_id = data["card_id"] end if data.include? "gateway_configuration" self.gateway_configuration = data["gateway_configuration"] end if data.include? "gateway_configuration_id" self.gateway_configuration_id = data["gateway_configuration_id"] end if data.include? "operations" self.operations = data["operations"] end if data.include? "refunds" self.refunds = data["refunds"] end if data.include? "name" self.name = data["name"] end if data.include? "amount" self.amount = data["amount"] end if data.include? "amount_local" self.amount_local = data["amount_local"] end if data.include? "authorized_amount" self.authorized_amount = data["authorized_amount"] end if data.include? "authorized_amount_local" self.authorized_amount_local = data["authorized_amount_local"] end if data.include? "captured_amount" self.captured_amount = data["captured_amount"] end if data.include? "captured_amount_local" self.captured_amount_local = data["captured_amount_local"] end if data.include? "refunded_amount" self.refunded_amount = data["refunded_amount"] end if data.include? "refunded_amount_local" self.refunded_amount_local = data["refunded_amount_local"] end if data.include? "available_amount" self.available_amount = data["available_amount"] end if data.include? "available_amount_local" self.available_amount_local = data["available_amount_local"] end if data.include? "currency" 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"] end if data.include? "status" self.status = data["status"] end if data.include? "authorized" 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"] end if data.include? "gateway_fee" self.gateway_fee = data["gateway_fee"] end if data.include? "gateway_fee_local" self.gateway_fee_local = data["gateway_fee_local"] end if data.include? "currency_fee" self.currency_fee = data["currency_fee"] end if data.include? "metadata" self.metadata = data["metadata"] end if data.include? "sandbox" 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 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
find(transaction_id, options = {})
click to toggle source
Find a transaction by its ID. Params:
transaction_id
-
ID of the transaction
options
-
Hash
of options
# File lib/processout/transaction.rb, line 868 def find(transaction_id, options = {}) self.prefill(options) request = Request.new(@client) path = "/transactions/" + CGI.escape(transaction_id) + "" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new body = response.body body = body["transaction"] obj = Transaction.new(@client) return_values.push(obj.fill_with_data(body)) return_values[0] end
find_refund(refund_id, options = {})
click to toggle source
Find a transaction's refund by its ID. Params:
refund_id
-
ID of the refund
options
-
Hash
of options
# File lib/processout/transaction.rb, line 813 def find_refund(refund_id, options = {}) self.prefill(options) request = Request.new(@client) path = "/transactions/" + CGI.escape(@id) + "/refunds/" + CGI.escape(refund_id) + "" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new body = response.body body = body["refund"] refund = Refund.new(@client) return_values.push(refund.fill_with_data(body)) return_values[0] end
gateway_configuration=(val)
click to toggle source
# File lib/processout/transaction.rb, line 191 def gateway_configuration=(val) if val.nil? @gateway_configuration = val return end if val.instance_of? GatewayConfiguration @gateway_configuration = val else obj = GatewayConfiguration.new(@client) obj.fill_with_data(val) @gateway_configuration = obj end end
gateway_configuration_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 207 def gateway_configuration_id=(val) @gateway_configuration_id = val end
gateway_fee=(val)
click to toggle source
# File lib/processout/transaction.rb, line 355 def gateway_fee=(val) @gateway_fee = val end
gateway_fee_local=(val)
click to toggle source
# File lib/processout/transaction.rb, line 359 def gateway_fee_local=(val) @gateway_fee_local = val end
gateway_name=(val)
click to toggle source
# File lib/processout/transaction.rb, line 307 def gateway_name=(val) @gateway_name = val end
id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 67 def id=(val) @id = val end
invoice=(val)
click to toggle source
# File lib/processout/transaction.rb, line 91 def invoice=(val) if val.nil? @invoice = val return end if val.instance_of? Invoice @invoice = val else obj = Invoice.new(@client) obj.fill_with_data(val) @invoice = obj end end
invoice_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 107 def invoice_id=(val) @invoice_id = val end
metadata=(val)
click to toggle source
# File lib/processout/transaction.rb, line 367 def metadata=(val) @metadata = val end
name=(val)
click to toggle source
# File lib/processout/transaction.rb, line 251 def name=(val) @name = val end
new(data = {})
click to toggle source
Create a new Transaction
using the current client
# File lib/processout/transaction.rb, line 477 def new(data = {}) Transaction.new(@client, data) end
operations=(val)
click to toggle source
# File lib/processout/transaction.rb, line 211 def operations=(val) if val.nil? @operations = [] return end if val.length > 0 and val[0].instance_of? TransactionOperation @operations = val else l = Array.new for v in val obj = TransactionOperation.new(@client) obj.fill_with_data(v) l.push(obj) end @operations = l end end
prefill(data)
click to toggle source
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
# File lib/processout/transaction.rb, line 717 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self.project = data.fetch(:project, self.project) self.project_id = data.fetch(:project_id, self.project_id) self.invoice = data.fetch(:invoice, self.invoice) self.invoice_id = data.fetch(:invoice_id, self.invoice_id) self.customer = data.fetch(:customer, self.customer) self.customer_id = data.fetch(:customer_id, self.customer_id) self.subscription = data.fetch(:subscription, self.subscription) self.subscription_id = data.fetch(:subscription_id, self.subscription_id) self.token = data.fetch(:token, self.token) self.token_id = data.fetch(:token_id, self.token_id) self.card = data.fetch(:card, self.card) self.card_id = data.fetch(:card_id, self.card_id) self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration) self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id) self.operations = data.fetch(:operations, self.operations) self.refunds = data.fetch(:refunds, self.refunds) self.name = data.fetch(:name, self.name) self.amount = data.fetch(:amount, self.amount) self.amount_local = data.fetch(:amount_local, self.amount_local) self.authorized_amount = data.fetch(:authorized_amount, self.authorized_amount) self.authorized_amount_local = data.fetch(:authorized_amount_local, self.authorized_amount_local) self.captured_amount = data.fetch(:captured_amount, self.captured_amount) self.captured_amount_local = data.fetch(:captured_amount_local, self.captured_amount_local) self.refunded_amount = data.fetch(:refunded_amount, self.refunded_amount) 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) 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.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
processout_fee=(val)
click to toggle source
# File lib/processout/transaction.rb, line 347 def processout_fee=(val) @processout_fee = val end
project=(val)
click to toggle source
# File lib/processout/transaction.rb, line 71 def project=(val) if val.nil? @project = val return end if val.instance_of? Project @project = val else obj = Project.new(@client) obj.fill_with_data(val) @project = obj end end
project_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 87 def project_id=(val) @project_id = val end
received_fraud_notification=(val)
click to toggle source
# File lib/processout/transaction.rb, line 339 def received_fraud_notification=(val) @received_fraud_notification = val end
received_retrieval_request=(val)
click to toggle source
# File lib/processout/transaction.rb, line 343 def received_retrieval_request=(val) @received_retrieval_request = val end
refunded=(val)
click to toggle source
# File lib/processout/transaction.rb, line 331 def refunded=(val) @refunded = val end
refunded_amount=(val)
click to toggle source
# File lib/processout/transaction.rb, line 279 def refunded_amount=(val) @refunded_amount = val end
refunded_amount_local=(val)
click to toggle source
# File lib/processout/transaction.rb, line 283 def refunded_amount_local=(val) @refunded_amount_local = val end
refunded_at=(val)
click to toggle source
# File lib/processout/transaction.rb, line 383 def refunded_at=(val) @refunded_at = val end
refunds=(val)
click to toggle source
# File lib/processout/transaction.rb, line 231 def refunds=(val) if val.nil? @refunds = [] return end if val.length > 0 and val[0].instance_of? Refund @refunds = val else l = Array.new for v in val obj = Refund.new(@client) obj.fill_with_data(v) l.push(obj) end @refunds = l end end
sandbox=(val)
click to toggle source
# File lib/processout/transaction.rb, line 371 def sandbox=(val) @sandbox = val end
status=(val)
click to toggle source
# File lib/processout/transaction.rb, line 315 def status=(val) @status = val end
subscription=(val)
click to toggle source
# File lib/processout/transaction.rb, line 131 def subscription=(val) if val.nil? @subscription = val return end if val.instance_of? Subscription @subscription = val else obj = Subscription.new(@client) obj.fill_with_data(val) @subscription = obj end end
subscription_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 147 def subscription_id=(val) @subscription_id = val end
three_d_s=(val)
click to toggle source
# File lib/processout/transaction.rb, line 387 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
three_d_s_status=(val)
click to toggle source
# File lib/processout/transaction.rb, line 311 def three_d_s_status=(val) @three_d_s_status = val end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/transaction.rb, line 482 def to_json(options) { "id": self.id, "project": self.project, "project_id": self.project_id, "invoice": self.invoice, "invoice_id": self.invoice_id, "customer": self.customer, "customer_id": self.customer_id, "subscription": self.subscription, "subscription_id": self.subscription_id, "token": self.token, "token_id": self.token_id, "card": self.card, "card_id": self.card_id, "gateway_configuration": self.gateway_configuration, "gateway_configuration_id": self.gateway_configuration_id, "operations": self.operations, "refunds": self.refunds, "name": self.name, "amount": self.amount, "amount_local": self.amount_local, "authorized_amount": self.authorized_amount, "authorized_amount_local": self.authorized_amount_local, "captured_amount": self.captured_amount, "captured_amount_local": self.captured_amount_local, "refunded_amount": self.refunded_amount, "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, "voided": self.voided, "refunded": self.refunded, "chargedback": self.chargedback, "received_fraud_notification": self.received_fraud_notification, "received_retrieval_request": self.received_retrieval_request, "processout_fee": self.processout_fee, "estimated_fee": self.estimated_fee, "gateway_fee": self.gateway_fee, "gateway_fee_local": self.gateway_fee_local, "currency_fee": self.currency_fee, "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
token=(val)
click to toggle source
# File lib/processout/transaction.rb, line 151 def token=(val) if val.nil? @token = val return end if val.instance_of? Token @token = val else obj = Token.new(@client) obj.fill_with_data(val) @token = obj end end
token_id=(val)
click to toggle source
# File lib/processout/transaction.rb, line 167 def token_id=(val) @token_id = val end
voided=(val)
click to toggle source
# File lib/processout/transaction.rb, line 327 def voided=(val) @voided = val end