7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/versapay/cli.rb', line 7
def send(amount, email, message=nil)
client = Client.new(
ENV.fetch('VERSAPAY_TOKEN'),
ENV.fetch('VERSAPAY_KEY'),
options[:demo] ? 'demo' : 'secure'
)
human_amount = "%.2f" % amount.to_f
answer = ask "Send $#{human_amount} to #{email} ?"
say "Running in demo environment..." if options[:demo]
if answer.downcase.strip =~ /^y(es)?$/
say "Sending $#{human_amount} to <#{email}>..."
response = client.send(amount, email, message)
puts "Success! Transaction token: #{response.fetch('token')}"
end
end
|