Module: RockRMS::Client::Transaction
- Included in:
- RockRMS::Client
- Defined in:
- lib/rock_rms/resources/transaction.rb
Constant Summary collapse
- PATH =
'FinancialTransactions'.freeze
Instance Method Summary collapse
- #create_transaction(authorized_person_id:, batch_id:, date:, funds:, payment_detail_id:, source_type_id: 10, transaction_code: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, transaction_type_value_id: 53, show_as_anonymous: nil) ⇒ Object
- #delete_transaction(id) ⇒ Object
- #find_donations_by_giving_id(id, raw = false) ⇒ Object
- #find_transaction(id) ⇒ Object
- #launch_transaction_workflow(id, workflow_type_id:, workflow_name:, attributes: {}) ⇒ Object
- #list_transactions(options = {}) ⇒ Object
- #refund_transaction(id) ⇒ Object
- #update_transaction(id, batch_id: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, source_type_id: nil, transaction_code: nil, transaction_type_value_id: nil, authorized_person_id: nil, date: nil, foreign_currency_code_value_id: nil, show_as_anonymous: nil) ⇒ Object
Instance Method Details
#create_transaction(authorized_person_id:, batch_id:, date:, funds:, payment_detail_id:, source_type_id: 10, transaction_code: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, transaction_type_value_id: 53, show_as_anonymous: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rock_rms/resources/transaction.rb', line 21 def create_transaction( authorized_person_id:, batch_id:, date:, funds:, payment_detail_id:, source_type_id: 10, transaction_code: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, transaction_type_value_id: 53, # contribution, registration show_as_anonymous: nil ) = { 'AuthorizedPersonAliasId' => , 'ScheduledTransactionId' => recurring_donation_id, 'BatchId' => batch_id, 'FinancialGatewayId' => gateway_id, 'FinancialPaymentDetailId' => payment_detail_id, 'TransactionCode' => transaction_code, 'TransactionDateTime' => date, 'TransactionDetails' => translate_funds(funds), 'TransactionTypeValueId' => transaction_type_value_id, 'SourceTypeValueId' => source_type_id, # website, kiosk, mobile app 'Summary' => summary } post(transaction_path, ) end |
#delete_transaction(id) ⇒ Object
83 84 85 |
# File 'lib/rock_rms/resources/transaction.rb', line 83 def delete_transaction(id) delete(transaction_path(id)) end |
#find_donations_by_giving_id(id, raw = false) ⇒ Object
11 12 13 14 |
# File 'lib/rock_rms/resources/transaction.rb', line 11 def find_donations_by_giving_id(id, raw = false) res = get("#{PATH}/GetByGivingId/#{id}?$expand=TransactionDetails") raw ? res : Response::Transaction.format(res) end |
#find_transaction(id) ⇒ Object
16 17 18 19 |
# File 'lib/rock_rms/resources/transaction.rb', line 16 def find_transaction(id) res = get(transaction_path(id)) Response::Transaction.format(res) end |
#launch_transaction_workflow(id, workflow_type_id:, workflow_name:, attributes: {}) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/rock_rms/resources/transaction.rb', line 91 def launch_transaction_workflow( id, workflow_type_id:, workflow_name:, attributes: {} ) query_string = "?workflowTypeId=#{workflow_type_id}&workflowName=#{workflow_name}" post(transaction_path + "/LaunchWorkflow/#{id}#{query_string}", attributes) end |
#list_transactions(options = {}) ⇒ Object
6 7 8 9 |
# File 'lib/rock_rms/resources/transaction.rb', line 6 def list_transactions( = {}) res = get(transaction_path, ) Response::Transaction.format(res) end |
#refund_transaction(id) ⇒ Object
87 88 89 |
# File 'lib/rock_rms/resources/transaction.rb', line 87 def refund_transaction(id) post(transaction_path + "/Refund/#{id}") end |
#update_transaction(id, batch_id: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, source_type_id: nil, transaction_code: nil, transaction_type_value_id: nil, authorized_person_id: nil, date: nil, foreign_currency_code_value_id: nil, show_as_anonymous: nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rock_rms/resources/transaction.rb', line 52 def update_transaction( id, batch_id: nil, summary: nil, recurring_donation_id: nil, gateway_id: nil, source_type_id: nil, transaction_code: nil, transaction_type_value_id: nil, authorized_person_id: nil, date: nil, foreign_currency_code_value_id: nil, show_as_anonymous: nil ) = {} ['Summary'] = summary if summary ['BatchId'] = batch_id if batch_id ['FinancialGatewayId'] = gateway_id if gateway_id ['ScheduledTransactionId'] = recurring_donation_id if recurring_donation_id ['SourceTypeValueId'] = source_type_id if source_type_id ['TransactionTypeValueId'] = transaction_type_value_id if transaction_type_value_id ['TransactionCode'] = transaction_code if transaction_code ['AuthorizedPersonAliasId'] = if ['TransactionDateTime'] = date if date ['ForeignCurrencyCodeValueId'] = foreign_currency_code_value_id if foreign_currency_code_value_id ['ShowAsAnonymous'] = show_as_anonymous if show_as_anonymous patch(transaction_path(id), ) end |