Class: Malipopay::Resources::Payments
- Inherits:
-
Object
- Object
- Malipopay::Resources::Payments
- Defined in:
- lib/malipopay/resources/payments.rb
Instance Method Summary collapse
-
#approve(params) ⇒ Hash
Approve a pending payment.
-
#collect(params) ⇒ Hash
Initiate a mobile money collection.
-
#create_link(params) ⇒ Hash
Create a payment link.
-
#disburse(params) ⇒ Hash
Initiate a disbursement (send money).
-
#get(reference) ⇒ Hash
Get a payment by reference.
-
#initialize(http_client) ⇒ Payments
constructor
A new instance of Payments.
-
#initiate(params) ⇒ Hash
Initiate a payment (collection or disbursement).
-
#list(params = {}) ⇒ Hash
List all payments.
-
#pay_now(params) ⇒ Hash
Process an instant payment.
-
#retry_collection(reference) ⇒ Hash
Retry a failed collection.
-
#search(params = {}) ⇒ Hash
Search payments.
-
#verify(reference) ⇒ Hash
Verify a payment by reference.
Constructor Details
#initialize(http_client) ⇒ Payments
Returns a new instance of Payments.
6 7 8 |
# File 'lib/malipopay/resources/payments.rb', line 6 def initialize(http_client) @http = http_client end |
Instance Method Details
#approve(params) ⇒ Hash
Approve a pending payment
69 70 71 |
# File 'lib/malipopay/resources/payments.rb', line 69 def approve(params) @http.post("/api/v1/payment/approve", body: params) end |
#collect(params) ⇒ Hash
Initiate a mobile money collection
20 21 22 |
# File 'lib/malipopay/resources/payments.rb', line 20 def collect(params) @http.post("/api/v1/payment/collection", body: params) end |
#create_link(params) ⇒ Hash
Create a payment link
83 84 85 |
# File 'lib/malipopay/resources/payments.rb', line 83 def create_link(params) @http.post("/api/v1/payment/link", body: params) end |
#disburse(params) ⇒ Hash
Initiate a disbursement (send money)
27 28 29 |
# File 'lib/malipopay/resources/payments.rb', line 27 def disburse(params) @http.post("/api/v1/payment/disbursement", body: params) end |
#get(reference) ⇒ Hash
Get a payment by reference
48 49 50 |
# File 'lib/malipopay/resources/payments.rb', line 48 def get(reference) @http.get("/api/v1/payment/reference/#{reference}") end |
#initiate(params) ⇒ Hash
Initiate a payment (collection or disbursement)
13 14 15 |
# File 'lib/malipopay/resources/payments.rb', line 13 def initiate(params) @http.post("/api/v1/payment", body: params) end |
#list(params = {}) ⇒ Hash
List all payments
55 56 57 |
# File 'lib/malipopay/resources/payments.rb', line 55 def list(params = {}) @http.get("/api/v1/payment", params: params) end |
#pay_now(params) ⇒ Hash
Process an instant payment
34 35 36 |
# File 'lib/malipopay/resources/payments.rb', line 34 def pay_now(params) @http.post("/api/v1/payment/now", body: params) end |
#retry_collection(reference) ⇒ Hash
Retry a failed collection
76 77 78 |
# File 'lib/malipopay/resources/payments.rb', line 76 def retry_collection(reference) @http.get("/api/v1/payment/retry/#{reference}") end |
#search(params = {}) ⇒ Hash
Search payments
62 63 64 |
# File 'lib/malipopay/resources/payments.rb', line 62 def search(params = {}) @http.get("/api/v1/payment/search", params: params) end |
#verify(reference) ⇒ Hash
Verify a payment by reference
41 42 43 |
# File 'lib/malipopay/resources/payments.rb', line 41 def verify(reference) @http.get("/api/v1/payment/verify/#{reference}") end |