Class: TokenizedCharge
- Defined in:
- lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#bulk_tokenized_charge(data) ⇒ Object
method to create bulk tokenized charges.
-
#bulk_tokenized_charge_status(bulk_id) ⇒ Object
method to get status of a bulk tokenized charges.
-
#bulk_tokenized_charge_transactions(bulk_id) ⇒ Object
method to get all the bulk tokenized transactions.
-
#tokenized_charge(data) ⇒ Object
method to charge with token.
-
#update_token(data, token) ⇒ Object
method for updating token detials.
- #verify_tokenized_charge(id) ⇒ Object
Methods inherited from Base
#check_passed_parameters, #delete_request, #get_request, #initialize, #post_request, #put_request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#bulk_tokenized_charge(data) ⇒ Object
method to create bulk tokenized charges
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 37 def bulk_tokenized_charge(data) base_url = flutterwave_object.base_url required_parameters = ["title", "retry_strategy", "bulk_data"] check_passed_parameters(required_parameters, data) payload = data.to_json response = post_request("#{base_url}/bulk-tokenized-charges/", payload) return response end |
#bulk_tokenized_charge_status(bulk_id) ⇒ Object
method to get status of a bulk tokenized charges
49 50 51 52 53 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 49 def bulk_tokenized_charge_status(bulk_id) base_url = flutterwave_object.base_url response = get_request("#{base_url}/bulk-tokenized-charges/#{bulk_id}") return response end |
#bulk_tokenized_charge_transactions(bulk_id) ⇒ Object
method to get all the bulk tokenized transactions
56 57 58 59 60 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 56 def bulk_tokenized_charge_transactions(bulk_id) base_url = flutterwave_object.base_url response = get_request("#{base_url}/bulk-tokenized-charges/#{bulk_id}/transactions") return response end |
#tokenized_charge(data) ⇒ Object
method to charge with token
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 7 def tokenized_charge(data) base_url = flutterwave_object.base_url # only update the payload with the transaction reference if it isn't already added to the payload if !data.key?("tx_ref") data.merge!({"tx_ref" => Util.transaction_reference_generator}) end required_parameters = [ "token", "currency", "country", "amount", "tx_ref", "email"] check_passed_parameters(required_parameters, data) response = post_request("#{base_url}/tokenized-charges", data.to_json) return response end |
#update_token(data, token) ⇒ Object
method for updating token detials
30 31 32 33 34 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 30 def update_token(data, token) base_url = flutterwave_object.base_url response = put_request("#{base_url}/tokens/#{token}", data.to_json) return response end |
#verify_tokenized_charge(id) ⇒ Object
23 24 25 26 27 |
# File 'lib/flutterwave_sdk/flutterwave_objects/tokenized_charge.rb', line 23 def verify_tokenized_charge(id) base_url = flutterwave_object.base_url response = get_request("#{base_url}/transactions/#{id}/verify") return response end |