Class: Spree::PagseguroProvider

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/pagseguro_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(order, user, notification_url, redirect_url) ⇒ PagseguroProvider

Returns a new instance of PagseguroProvider.



2
3
4
5
6
7
# File 'app/models/spree/pagseguro_provider.rb', line 2

def initialize(order, user, notification_url, redirect_url)
  @order = order
  @user = user
  @notification_url = notification_url
  @redirect_url = redirect_url
end

Instance Method Details

#init_transaction!Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/spree/pagseguro_provider.rb', line 9

def init_transaction!
  payment = PagSeguro::PaymentRequest.new
  payment.reference = @order.id
  payment.extra_amount = @order.adjustment_total
  build_items_to payment
  payment.shipping = PagSeguro::Shipping.new shipping_options
  payment.sender = sender
  payment.notification_url = @notification_url
  payment.redirect_url = @redirect_url
  payment.register
end