Module: Bygpay::Utils
- Included in:
- Deposits, Withdrawals
- Defined in:
- lib/bygpay/utils.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#meta_data ⇒ Object
Returns the value of attribute meta_data.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_text ⇒ Object
Returns the value of attribute response_text.
-
#result ⇒ Object
Returns the value of attribute result.
-
#status ⇒ Object
Returns the value of attribute status.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#card_deposit_endpoint ⇒ Object
Mobile Deposit transactions endpoint.
-
#deposit_status_endpoint ⇒ Object
Deposit transactions status check endpoint.
- #expresspay_deposit_endpoint ⇒ Object
-
#get_status(endpoint, uuid) ⇒ Object
Get transaction status.
-
#http_connect ⇒ Object
global Bygpay connect.
- #hubtel_deposit_endpoint ⇒ Object
-
#mobile_deposit_endpoint ⇒ Object
Mobile Deposit transactions endpoint.
-
#mobile_withdraw_endpoint ⇒ Object
Mobile Withdrawal transactions endpoint.
-
#parse_response(json_payload) ⇒ Object
Parse on JSON Body to BygResponse for parsing and processing.
- #paystack_deposit_endpoint ⇒ Object
-
#post(endpoint, payload = {}) ⇒ Object
Post payload.
-
#rave_deposit_endpoint ⇒ Object
Rave Deposit transactions endpoint.
-
#withdraw_status_endpoint ⇒ Object
Withdraw transactions status check endpoint.
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def amount @amount end |
#meta_data ⇒ Object
Returns the value of attribute meta_data.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def @meta_data end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def response @response end |
#response_text ⇒ Object
Returns the value of attribute response_text.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def response_text @response_text end |
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def result @result end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def status @status end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def transaction_id @transaction_id end |
#uuid ⇒ Object
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/bygpay/utils.rb', line 5 def uuid @uuid end |
Instance Method Details
#card_deposit_endpoint ⇒ Object
Mobile Deposit transactions endpoint
31 32 33 |
# File 'lib/bygpay/utils.rb', line 31 def card_deposit_endpoint Bygpay.configuration.deposit_card_path end |
#deposit_status_endpoint ⇒ Object
Deposit transactions status check endpoint
36 37 38 |
# File 'lib/bygpay/utils.rb', line 36 def deposit_status_endpoint Bygpay.configuration.deposit_status_path end |
#expresspay_deposit_endpoint ⇒ Object
18 19 20 |
# File 'lib/bygpay/utils.rb', line 18 def expresspay_deposit_endpoint Bygpay.configuration.deposit_expresspay_path end |
#get_status(endpoint, uuid) ⇒ Object
Get transaction status
59 60 61 62 63 64 |
# File 'lib/bygpay/utils.rb', line 59 def get_status(endpoint, uuid) url = "#{Bygpay.configuration.base_url}#{endpoint}" result = http_connect.get("#{url}/#{uuid}") parse_response(result.body) end |
#http_connect ⇒ Object
global Bygpay connect
80 81 82 |
# File 'lib/bygpay/utils.rb', line 80 def http_connect HTTP[Authorization: Bygpay.configuration.api_key] end |
#hubtel_deposit_endpoint ⇒ Object
26 27 28 |
# File 'lib/bygpay/utils.rb', line 26 def hubtel_deposit_endpoint Bygpay.configuration.deposit_hubtel_path end |
#mobile_deposit_endpoint ⇒ Object
Mobile Deposit transactions endpoint
9 10 11 |
# File 'lib/bygpay/utils.rb', line 9 def mobile_deposit_endpoint Bygpay.configuration.deposit_mobile_path end |
#mobile_withdraw_endpoint ⇒ Object
Mobile Withdrawal transactions endpoint
41 42 43 |
# File 'lib/bygpay/utils.rb', line 41 def mobile_withdraw_endpoint Bygpay.configuration.withdraw_mobile_path end |
#parse_response(json_payload) ⇒ Object
Parse on JSON Body to BygResponse for parsing and processing
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/bygpay/utils.rb', line 67 def parse_response(json_payload) @response = Bygpay::BygResponse.parse_response(json_payload) resp = @response.data @transaction_id = @response.transaction_id @response_text = resp. @uuid = @response.uuid @amount = @response.amount @meta_data = @response. @status = @response.transaction_status @result = @response.request_successful? end |
#paystack_deposit_endpoint ⇒ Object
22 23 24 |
# File 'lib/bygpay/utils.rb', line 22 def paystack_deposit_endpoint Bygpay.configuration.deposit_paystack_path end |
#post(endpoint, payload = {}) ⇒ Object
Post payload
51 52 53 54 55 56 |
# File 'lib/bygpay/utils.rb', line 51 def post(endpoint, payload = {}) url = "#{Bygpay.configuration.base_url}#{endpoint}" result = http_connect.post(url, json: payload) parse_response(result.body) end |
#rave_deposit_endpoint ⇒ Object
Rave Deposit transactions endpoint
14 15 16 |
# File 'lib/bygpay/utils.rb', line 14 def rave_deposit_endpoint Bygpay.configuration.deposit_rave_path end |
#withdraw_status_endpoint ⇒ Object
Withdraw transactions status check endpoint
46 47 48 |
# File 'lib/bygpay/utils.rb', line 46 def withdraw_status_endpoint Bygpay.configuration.withdraw_status_path end |