Class: Sanwo::Client
- Inherits:
-
Object
- Object
- Sanwo::Client
- Defined in:
- lib/sanwo/client.rb
Overview
Server-side HTML generator for Sanwo checkout.
This class does NOT make any HTTP requests. It produces front-end markup that delegates to the Sanwo embed script loaded from the CDN.
Constant Summary collapse
- CDN_URL =
"https://cdn.jsdelivr.net/npm/@sanwohq/embed/dist/sanwo.global.js"
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#template_url ⇒ Object
readonly
Returns the value of attribute template_url.
Instance Method Summary collapse
-
#config ⇒ Hash
Return the current configuration as a plain hash.
-
#initialize(provider:, public_key:, currency: "NGN", debug: false, template_url: nil, template: nil) ⇒ Client
constructor
A new instance of Client.
-
#render_checkout(amount:, email:, description: nil, reference: nil, currency: nil, button_text: "Pay Now", button_class: "sanwo-button", first_name: nil, last_name: nil, phone: nil, callback: nil) ⇒ String
Render a complete checkout button with inline JavaScript.
-
#render_custom_amount(email: nil, currency: nil, button_text: "Pay Now", placeholder: "Enter amount", min_amount: nil, max_amount: nil, description: nil, first_name: nil, last_name: nil, phone: nil, callback: nil) ⇒ String
Render a custom-amount checkout widget.
-
#render_script ⇒ String
Return a