Class: Reggora::SchedulePaymentApp

Inherits:
Object
  • Object
show all
Defined in:
lib/reggora/Entity/Lender/schedule_payment_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SchedulePaymentApp

Returns a new instance of SchedulePaymentApp.



3
4
5
# File 'lib/reggora/Entity/Lender/schedule_payment_app.rb', line 3

def initialize(client)
  @client = client
end

Instance Method Details

Parameters:

  • order_id (String)
  • link_type (String)

    : payment/schedule/both

  • consumer_id (String)


19
20
21
# File 'lib/reggora/Entity/Lender/schedule_payment_app.rb', line 19

def consumer_app_link(order_id, consumer_id, link_type)
  @client.get("/#{order_id}/#{consumer_id}/#{link_type}")
end

#payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '') ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/reggora/Entity/Lender/schedule_payment_app.rb', line 23

def payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')

  attributes = {
      consumer_email: consumer_email,
      order_id: order_id,
      user_type: user_type,
      payment_type: payment_type,
      amount: amount
  }

  attributes.merge!({firstname: firstname, lastname: lastname, paid: false}) if user_type == 'manual'
  attributes
end

#send_payment_app(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '') ⇒ Object



7
8
9
10
# File 'lib/reggora/Entity/Lender/schedule_payment_app.rb', line 7

def send_payment_app(consumer_email, order_id, user_type, payment_type, amount, firstname = '', lastname = '')
  payment_params = payment_attributes(consumer_email, order_id, user_type, payment_type, amount, firstname, lastname)
  @client.post('/consumer/payment', payment_params)
end

#send_scheduling_app(consumer_emails, order_id) ⇒ Object



12
13
14
# File 'lib/reggora/Entity/Lender/schedule_payment_app.rb', line 12

def send_scheduling_app(consumer_emails, order_id)
  @client.post("/consumer/scheduling", {consumer_emails: consumer_emails, order_id: order_id})
end