Class: ProcessOut::Transaction
- Inherits:
-
Object
- Object
- ProcessOut::Transaction
- Defined in:
- lib/processout/transaction.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#amount_local ⇒ Object
Returns the value of attribute amount_local.
-
#authorized ⇒ Object
Returns the value of attribute authorized.
-
#authorized_amount ⇒ Object
Returns the value of attribute authorized_amount.
-
#authorized_amount_local ⇒ Object
Returns the value of attribute authorized_amount_local.
-
#available_amount ⇒ Object
Returns the value of attribute available_amount.
-
#available_amount_local ⇒ Object
Returns the value of attribute available_amount_local.
-
#captured ⇒ Object
Returns the value of attribute captured.
-
#captured_amount ⇒ Object
Returns the value of attribute captured_amount.
-
#captured_amount_local ⇒ Object
Returns the value of attribute captured_amount_local.
-
#card ⇒ Object
Returns the value of attribute card.
-
#card_id ⇒ Object
Returns the value of attribute card_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#currency_fee ⇒ Object
Returns the value of attribute currency_fee.
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#estimated_fee ⇒ Object
Returns the value of attribute estimated_fee.
-
#gateway_configuration ⇒ Object
Returns the value of attribute gateway_configuration.
-
#gateway_configuration_id ⇒ Object
Returns the value of attribute gateway_configuration_id.
-
#gateway_fee ⇒ Object
Returns the value of attribute gateway_fee.
-
#gateway_fee_local ⇒ Object
Returns the value of attribute gateway_fee_local.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invoice ⇒ Object
Returns the value of attribute invoice.
-
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#operations ⇒ Object
Returns the value of attribute operations.
-
#processout_fee ⇒ Object
Returns the value of attribute processout_fee.
-
#project ⇒ Object
Returns the value of attribute project.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#refunded_amount ⇒ Object
Returns the value of attribute refunded_amount.
-
#refunded_amount_local ⇒ Object
Returns the value of attribute refunded_amount_local.
-
#refunds ⇒ Object
Returns the value of attribute refunds.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subscription ⇒ Object
Returns the value of attribute subscription.
-
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
-
#three_d_s_status ⇒ Object
Returns the value of attribute three_d_s_status.
-
#token ⇒ Object
Returns the value of attribute token.
-
#token_id ⇒ Object
Returns the value of attribute token_id.
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
Get all the transactions.
-
#fetch_refunds(options = {}) ⇒ Object
Get the transaction’s refunds.
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data -
Hashof data coming from the API.
- Fills the object with data coming from the API Params:
-
#find(transaction_id, options = {}) ⇒ Object
Find a transaction by its ID.
-
#find_refund(refund_id, options = {}) ⇒ Object
Find a transaction’s refund by its ID.
-
#initialize(client, data = {}) ⇒ Transaction
constructor
- Initializes the Transaction object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the Transaction object Params:
-
#new(data = {}) ⇒ Object
Create a new Transaction using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data -
Hashof data.
- Prefills the object with the data passed as parameters Params:
Constructor Details
#initialize(client, data = {}) ⇒ Transaction
Initializes the Transaction object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/processout/transaction.rb', line 343 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. = data.fetch(:authorized_amount, nil) self. = 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.three_d_s_status = data.fetch(:three_d_s_status, nil) self.status = data.fetch(:status, nil) self. = data.fetch(:authorized, nil) self.captured = data.fetch(:captured, 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. = data.fetch(:metadata, nil) self.sandbox = data.fetch(:sandbox, nil) self.created_at = data.fetch(:created_at, nil) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
28 29 30 |
# File 'lib/processout/transaction.rb', line 28 def amount @amount end |
#amount_local ⇒ Object
Returns the value of attribute amount_local.
29 30 31 |
# File 'lib/processout/transaction.rb', line 29 def amount_local @amount_local end |
#authorized ⇒ Object
Returns the value of attribute authorized.
42 43 44 |
# File 'lib/processout/transaction.rb', line 42 def end |
#authorized_amount ⇒ Object
Returns the value of attribute authorized_amount.
30 31 32 |
# File 'lib/processout/transaction.rb', line 30 def end |
#authorized_amount_local ⇒ Object
Returns the value of attribute authorized_amount_local.
31 32 33 |
# File 'lib/processout/transaction.rb', line 31 def end |
#available_amount ⇒ Object
Returns the value of attribute available_amount.
36 37 38 |
# File 'lib/processout/transaction.rb', line 36 def available_amount @available_amount end |
#available_amount_local ⇒ Object
Returns the value of attribute available_amount_local.
37 38 39 |
# File 'lib/processout/transaction.rb', line 37 def available_amount_local @available_amount_local end |
#captured ⇒ Object
Returns the value of attribute captured.
43 44 45 |
# File 'lib/processout/transaction.rb', line 43 def captured @captured end |
#captured_amount ⇒ Object
Returns the value of attribute captured_amount.
32 33 34 |
# File 'lib/processout/transaction.rb', line 32 def captured_amount @captured_amount end |
#captured_amount_local ⇒ Object
Returns the value of attribute captured_amount_local.
33 34 35 |
# File 'lib/processout/transaction.rb', line 33 def captured_amount_local @captured_amount_local end |
#card ⇒ Object
Returns the value of attribute card.
21 22 23 |
# File 'lib/processout/transaction.rb', line 21 def card @card end |
#card_id ⇒ Object
Returns the value of attribute card_id.
22 23 24 |
# File 'lib/processout/transaction.rb', line 22 def card_id @card_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
51 52 53 |
# File 'lib/processout/transaction.rb', line 51 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
38 39 40 |
# File 'lib/processout/transaction.rb', line 38 def currency @currency end |
#currency_fee ⇒ Object
Returns the value of attribute currency_fee.
48 49 50 |
# File 'lib/processout/transaction.rb', line 48 def currency_fee @currency_fee end |
#customer ⇒ Object
Returns the value of attribute customer.
15 16 17 |
# File 'lib/processout/transaction.rb', line 15 def customer @customer end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
16 17 18 |
# File 'lib/processout/transaction.rb', line 16 def customer_id @customer_id end |
#error_code ⇒ Object
Returns the value of attribute error_code.
39 40 41 |
# File 'lib/processout/transaction.rb', line 39 def error_code @error_code end |
#estimated_fee ⇒ Object
Returns the value of attribute estimated_fee.
45 46 47 |
# File 'lib/processout/transaction.rb', line 45 def estimated_fee @estimated_fee end |
#gateway_configuration ⇒ Object
Returns the value of attribute gateway_configuration.
23 24 25 |
# File 'lib/processout/transaction.rb', line 23 def gateway_configuration @gateway_configuration end |
#gateway_configuration_id ⇒ Object
Returns the value of attribute gateway_configuration_id.
24 25 26 |
# File 'lib/processout/transaction.rb', line 24 def gateway_configuration_id @gateway_configuration_id end |
#gateway_fee ⇒ Object
Returns the value of attribute gateway_fee.
46 47 48 |
# File 'lib/processout/transaction.rb', line 46 def gateway_fee @gateway_fee end |
#gateway_fee_local ⇒ Object
Returns the value of attribute gateway_fee_local.
47 48 49 |
# File 'lib/processout/transaction.rb', line 47 def gateway_fee_local @gateway_fee_local end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/processout/transaction.rb', line 10 def id @id end |
#invoice ⇒ Object
Returns the value of attribute invoice.
13 14 15 |
# File 'lib/processout/transaction.rb', line 13 def invoice @invoice end |
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
14 15 16 |
# File 'lib/processout/transaction.rb', line 14 def invoice_id @invoice_id end |
#metadata ⇒ Object
Returns the value of attribute metadata.
49 50 51 |
# File 'lib/processout/transaction.rb', line 49 def end |
#name ⇒ Object
Returns the value of attribute name.
27 28 29 |
# File 'lib/processout/transaction.rb', line 27 def name @name end |
#operations ⇒ Object
Returns the value of attribute operations.
25 26 27 |
# File 'lib/processout/transaction.rb', line 25 def operations @operations end |
#processout_fee ⇒ Object
Returns the value of attribute processout_fee.
44 45 46 |
# File 'lib/processout/transaction.rb', line 44 def processout_fee @processout_fee end |
#project ⇒ Object
Returns the value of attribute project.
11 12 13 |
# File 'lib/processout/transaction.rb', line 11 def project @project end |
#project_id ⇒ Object
Returns the value of attribute project_id.
12 13 14 |
# File 'lib/processout/transaction.rb', line 12 def project_id @project_id end |
#refunded_amount ⇒ Object
Returns the value of attribute refunded_amount.
34 35 36 |
# File 'lib/processout/transaction.rb', line 34 def refunded_amount @refunded_amount end |
#refunded_amount_local ⇒ Object
Returns the value of attribute refunded_amount_local.
35 36 37 |
# File 'lib/processout/transaction.rb', line 35 def refunded_amount_local @refunded_amount_local end |
#refunds ⇒ Object
Returns the value of attribute refunds.
26 27 28 |
# File 'lib/processout/transaction.rb', line 26 def refunds @refunds end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
50 51 52 |
# File 'lib/processout/transaction.rb', line 50 def sandbox @sandbox end |
#status ⇒ Object
Returns the value of attribute status.
41 42 43 |
# File 'lib/processout/transaction.rb', line 41 def status @status end |
#subscription ⇒ Object
Returns the value of attribute subscription.
17 18 19 |
# File 'lib/processout/transaction.rb', line 17 def subscription @subscription end |
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
18 19 20 |
# File 'lib/processout/transaction.rb', line 18 def subscription_id @subscription_id end |
#three_d_s_status ⇒ Object
Returns the value of attribute three_d_s_status.
40 41 42 |
# File 'lib/processout/transaction.rb', line 40 def three_d_s_status @three_d_s_status end |
#token ⇒ Object
Returns the value of attribute token.
19 20 21 |
# File 'lib/processout/transaction.rb', line 19 def token @token end |
#token_id ⇒ Object
Returns the value of attribute token_id.
20 21 22 |
# File 'lib/processout/transaction.rb', line 20 def token_id @token_id end |
Instance Method Details
#all(options = {}) ⇒ Object
Get all the transactions. Params:
options-
Hashof options
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
# File 'lib/processout/transaction.rb', line 644 def all( = {}) self.prefill() request = Request.new(@client) path = "/transactions" data = { } response = Response.new(request.get(path, data, )) 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 |
#fetch_refunds(options = {}) ⇒ Object
Get the transaction’s refunds. Params:
options-
Hashof options
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'lib/processout/transaction.rb', line 589 def fetch_refunds( = {}) self.prefill() request = Request.new(@client) path = "/transactions/" + CGI.escape(@id) + "/refunds" data = { } response = Response.new(request.get(path, data, )) 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) ⇒ Object
Fills the object with data coming from the API Params:
data-
Hashof data coming from the API
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/processout/transaction.rb', line 399 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. = data["authorized_amount"] end if data.include? "authorized_amount_local" self. = 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? "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. = data["authorized"] end if data.include? "captured" self.captured = data["captured"] 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. = data["metadata"] end if data.include? "sandbox" self.sandbox = data["sandbox"] end if data.include? "created_at" self.created_at = data["created_at"] end self end |
#find(transaction_id, options = {}) ⇒ Object
Find a transaction by its ID. Params:
transaction_id-
ID of the transaction
options-
Hashof options
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'lib/processout/transaction.rb', line 675 def find(transaction_id, = {}) self.prefill() request = Request.new(@client) path = "/transactions/" + CGI.escape(transaction_id) + "" data = { } response = Response.new(request.get(path, data, )) 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 = {}) ⇒ Object
Find a transaction’s refund by its ID. Params:
refund_id-
ID of the refund
options-
Hashof options
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/processout/transaction.rb', line 620 def find_refund(refund_id, = {}) self.prefill() request = Request.new(@client) path = "/transactions/" + CGI.escape(@id) + "/refunds/" + CGI.escape(refund_id) + "" data = { } response = Response.new(request.get(path, data, )) 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 |
#new(data = {}) ⇒ Object
Create a new Transaction using the current client
392 393 394 |
# File 'lib/processout/transaction.rb', line 392 def new(data = {}) Transaction.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/processout/transaction.rb', line 536 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. = data.fetch(:authorized_amount, self.) self. = data.fetch(:authorized_amount_local, self.) 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.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status) self.status = data.fetch(:status, self.status) self. = data.fetch(:authorized, self.) self.captured = data.fetch(:captured, self.captured) 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. = data.fetch(:metadata, self.) self.sandbox = data.fetch(:sandbox, self.sandbox) self.created_at = data.fetch(:created_at, self.created_at) self end |