lib/xapo_tools.rb in xapo_sdk-0.2.0 vs lib/xapo_tools.rb in xapo_sdk-0.2.1
- old
+ new
@@ -27,15 +27,21 @@
# amount_BIT (float, optional): The amount of bitcoins to be payed by the
# widget. If not specified here, it must be entered on payment basis.
# pay_type (str): The string representing the type of operation
# ("Tip", "Pay", "Deposit" or "Donate").
def micro_payment_config
- return Hash[:sender_user_id => "", :sender_user_email => "",
- :sender_user_cellphone => "", :receiver_user_id => "",
- :receiver_user_email => "", :pay_object_id => "",
- :amount_BIT => 0, :timestamp => XapoUtils.timestamp,
- :pay_type => ""]
+ return Hash[
+ :sender_user_id => "",
+ :sender_user_email => "",
+ :sender_user_cellphone => "",
+ :receiver_user_id => "",
+ :receiver_user_email => "",
+ :pay_object_id => "",
+ :amount_BIT => 0,
+ :timestamp => XapoUtils.timestamp,
+ :pay_type => ""
+ ]
end
# Xapo's payment buttons snippet builder.
#
# This class allows the construction of 2 kind of widgets, *div* and
@@ -56,19 +62,19 @@
def build_url(config)
json_config = JSON.generate(config)
if @app_secret == nil || @app_id == nil
query_str = URI.encode_www_form(
- "payload" => json_config,
- "customization" => JSON.generate({"button_text" => config[:pay_type]})
+ :payload => json_config,
+ :customization => JSON.generate({:button_text => config[:pay_type]})
)
else
encrypted_config = XapoUtils.encrypt(json_config, @app_secret)
query_str = URI.encode_www_form(
- "app_id" => @app_id,
- "button_request" => encrypted_config,
- "customization" => JSON.generate({"button_text" => config[:pay_type]})
+ :app_id => @app_id,
+ :button_request => encrypted_config,
+ :customization => JSON.generate({:button_text => config[:pay_type]})
)
end
widget_url = @service_url + "?" + query_str
\ No newline at end of file