Class: K2ConnectRuby::K2Entity::K2FinancialEntities::StkPush::StkPushRequest

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kwargs) ⇒ StkPushRequest

Returns a new instance of StkPushRequest.



16
17
18
19
20
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 16

def initialize(kwargs)
  kwargs.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def amount
  @amount
end

#callback_urlObject

Returns the value of attribute callback_url.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def callback_url
  @callback_url
end

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def last_name
  @last_name
end

#metadataObject

Returns the value of attribute metadata.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def 
  @metadata
end

#middle_nameObject

Returns the value of attribute middle_name.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def middle_name
  @middle_name
end

#payment_channelObject

Returns the value of attribute payment_channel.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def payment_channel
  @payment_channel
end

#phone_numberObject

Returns the value of attribute phone_number.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def phone_number
  @phone_number
end

#till_numberObject

Returns the value of attribute till_number.



10
11
12
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 10

def till_number
  @till_number
end

Instance Method Details

#endpointObject



22
23
24
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 22

def endpoint
  K2ConnectRuby::K2Utilities::Config::K2Config.endpoint("incoming_payments")
end

#request_bodyObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb', line 26

def request_body
  {
    payment_channel: payment_channel,
    till_number: till_number,
    subscriber: {
      first_name: first_name,
      middle_name: middle_name,
      last_name: last_name,
      phone_number: phone_number,
      email: email,
    },
    amount: {
      currency: "KES",
      value: amount,
    },
    metadata: ,
    _links: {
      callback_url: callback_url,
    },
  }
end