lib/revo/loans_api/client.rb in revo-loans_api-0.0.53 vs lib/revo/loans_api/client.rb in revo-loans_api-0.0.54

- old
+ new

@@ -102,15 +102,23 @@ def send_loan_confirmation_message(token:) make_request(:post, "loan_requests/#{token}/client/confirmation") end - def complete_loan_request(token:, code:) + def complete_loan_request(token:, code: nil, session_id: nil) + complete_params = {} + + if session_id + complete_params[:session_id] = session_id + else + complete_params[:code] = code + end + make_request( :post, "loan_requests/#{token}/confirmation", - params: { code: code }, + params: complete_params, headers: { 'Application-Source': application_source } ) end def create_loan(token:, term_id:) @@ -120,17 +128,19 @@ params: { term_id: term_id }, headers: { 'Application-Source': application_source } ) end - def finalize_loan(token:, code:, sms_info: '0', skip_confirmation: false) + def finalize_loan(token:, code: nil, sms_info: '0', skip_confirmation: false, session_id: nil) loan_params = { agree_processing: '1', - confirmation_code: code, agree_sms_info: sms_info } + loan_params[:confirmation_code] = code if code + loan_params[:session_id] = session_id if session_id + if skip_confirmation loan_params[:skip_confirmation] = true loan_params.delete(:confirmation_code) end @@ -252,14 +262,21 @@ def send_billing_shift_confirmation_code(client_id:) make_request(:post, "clients/#{client_id}/billing_shift") end - def confirm_billing_shift(client_id:, code:, billing_chain:) + def confirm_billing_shift(client_id:, billing_chain:, code: nil, session_id: nil) + confirmation_params = { + billing_chain: billing_chain + } + + confirmation_params[:code] = code if code + confirmation_params[:session_id] = session_id if session_id + make_request( :post, "clients/#{client_id}/billing_shift/confirmation", - params: { code: code, billing_chain: billing_chain } + params: confirmation_params ) end def billing_shift_info(client_id:) make_request(:get, "clients/#{client_id}/billing_shift/info")