Sha256: 3a94612095829508326d4ef7ed946feca133c6803b1e99f13f250c2f062eaa1a
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
require 'bodega/payment_method/base' module Bodega module PaymentMethod class Paypal < Base options :username, :password, :signature def checkout_url(success_url, cancel_url) response = client.setup(request, success_url, cancel_url) response.redirect_uri end def complete! response = client.checkout!( options[:token], options[:PayerID], request ) response.payment_info.last.transaction_id end protected def client @client ||= ::Paypal::Express::Request.new( username: Bodega.config.paypal.username, password: Bodega.config.paypal.password, signature: Bodega.config.paypal.signature ) end def request @request ||= ::Paypal::Payment::Request.new( amount: order.subtotal, description: order.order_products.map(&:quantity_and_name).to_sentence ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bodega-0.2.0 | lib/bodega/payment_method/paypal.rb |