Class: MtnCmMomoSdk::APIService

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/mtn_cm_momo_sdk/api.rb

Overview

Your code goes here…

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transaction) ⇒ APIService

Returns a new instance of APIService.

Parameters:

  • transaction (Object)


10
11
12
13
14
15
16
17
18
# File 'lib/mtn_cm_momo_sdk/api.rb', line 10

def initialize(transaction)
  @transaction = transaction.nil? ?

                     {
                         idbouton: 2,
                         typebouton: 'PAIE',
                         _clP: MtnCmMomoSdk.developer_clP,
                         _email: MtnCmMomoSdk.developer_email
                     } : transaction
end

Instance Attribute Details

#body=(value) ⇒ Object

Sets the attribute body

Parameters:

  • value

    the value to set the attribute body to.



7
8
9
# File 'lib/mtn_cm_momo_sdk/api.rb', line 7

def body=(value)
  @body = value
end

Instance Method Details

#buy_now!(tel, amount) ⇒ Object

Parameters:

  • amount (Object)


21
22
23
24
25
26
# File 'lib/mtn_cm_momo_sdk/api.rb', line 21

def buy_now!(tel, amount)
  da = body.merge!(_amount: amount)
           .merge!(_tel: tel)
  # da =  payload(da)

  call_server '/transactionRequest.xhtml', da
end

#checkout!(tel, amount) ⇒ Object



42
43
44
45
46
47
# File 'lib/mtn_cm_momo_sdk/api.rb', line 42

def checkout!(tel, amount)
  da = body.merge!(_amount: amount)
           .merge!(_tel: tel)
  # da =  payload(da)

  call_server '/transactionRequest.xhtml', da
end

#donate!(tel, amount) ⇒ Object



35
36
37
38
39
40
# File 'lib/mtn_cm_momo_sdk/api.rb', line 35

def donate!(tel, amount)
  da = body.merge!(_amount: amount)
           .merge!(_tel: tel)
  # da =  payload(da)

  call_server '/transaction.xhtml', da
end

#refund!(tel, amount) ⇒ Object



28
29
30
31
32
33
# File 'lib/mtn_cm_momo_sdk/api.rb', line 28

def refund!(tel, amount)
  da = body.merge!(_amount: amount)
           .merge!(_tel: tel)
  # da =  payload(da)

  call_server '/transaction.xhtml', da
end