Class: EasyPost::Services::BetaReferralCustomer
- Defined in:
- lib/easypost/services/beta_referral_customer.rb
Instance Method Summary collapse
-
#add_payment_method(stripe_customer_id, payment_method_reference, priority = 'primary') ⇒ Object
Add a Stripe payment method to a ReferralCustomer Customer.
-
#create_bank_account_client_secret(return_url = nil) ⇒ Object
Creates a client secret to use with Stripe when adding a bank account.
-
#create_credit_card_client_secret ⇒ Object
Creates a client secret to use with Stripe when adding a credit card.
-
#refund_by_amount(amount) ⇒ Object
Refund a ReferralCustomer Customer’s wallet by a specified amount.
-
#refund_by_payment_log(payment_log_id) ⇒ Object
Refund a ReferralCustomer Customer’s wallet for a specified payment log entry.
Methods inherited from Service
Constructor Details
This class inherits a constructor from EasyPost::Services::Service
Instance Method Details
#add_payment_method(stripe_customer_id, payment_method_reference, priority = 'primary') ⇒ Object
Add a Stripe payment method to a ReferralCustomer Customer. This function requires the ReferralCustomer Customer’s API key.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/easypost/services/beta_referral_customer.rb', line 5 def add_payment_method(stripe_customer_id, payment_method_reference, priority = 'primary') wrapped_params = { payment_method: { stripe_customer_id: stripe_customer_id, payment_method_reference: payment_method_reference, priority: priority.downcase, }, } response = @client.make_request( :post, 'referral_customers/payment_method', wrapped_params, 'beta', ) EasyPost::InternalUtilities::Json.convert_json_to_object(response) end |
#create_bank_account_client_secret(return_url = nil) ⇒ Object
Creates a client secret to use with Stripe when adding a bank account.
53 54 55 56 57 58 |
# File 'lib/easypost/services/beta_referral_customer.rb', line 53 def create_bank_account_client_secret(return_url = nil) params = return_url ? { return_url: return_url } : nil response = @client.make_request(:post, 'financial_connections_sessions', params, 'beta') EasyPost::InternalUtilities::Json.convert_json_to_object(response) end |
#create_credit_card_client_secret ⇒ Object
Creates a client secret to use with Stripe when adding a credit card.
46 47 48 49 50 |
# File 'lib/easypost/services/beta_referral_customer.rb', line 46 def create_credit_card_client_secret response = @client.make_request(:post, 'setup_intents', nil, 'beta') EasyPost::InternalUtilities::Json.convert_json_to_object(response) end |
#refund_by_amount(amount) ⇒ Object
Refund a ReferralCustomer Customer’s wallet by a specified amount. Refund will be issued to the user’s original payment method. This function requires the ReferralCustomer Customer’s API key.
25 26 27 28 29 30 31 32 |
# File 'lib/easypost/services/beta_referral_customer.rb', line 25 def refund_by_amount(amount) params = { refund_amount: amount, } response = @client.make_request(:post, 'referral_customers/refunds', params, 'beta') EasyPost::InternalUtilities::Json.convert_json_to_object(response) end |
#refund_by_payment_log(payment_log_id) ⇒ Object
Refund a ReferralCustomer Customer’s wallet for a specified payment log entry. Refund will be issued to the user’s original payment method. This function requires the ReferralCustomer Customer’s API key.
36 37 38 39 40 41 42 43 |
# File 'lib/easypost/services/beta_referral_customer.rb', line 36 def refund_by_payment_log(payment_log_id) params = { payment_log_id: payment_log_id, } response = @client.make_request(:post, 'referral_customers/refunds', params, 'beta') EasyPost::InternalUtilities::Json.convert_json_to_object(response) end |