Class: PagSeguro::Refund

Inherits:
Object
  • Object
show all
Includes:
Extensions::MassAssignment
Defined in:
lib/pagseguro/refund.rb,
lib/pagseguro/refund/response.rb,
lib/pagseguro/refund/serializer.rb,
lib/pagseguro/refund/request_serializer.rb,
lib/pagseguro/refund/response_serializer.rb

Defined Under Namespace

Classes: RequestSerializer, Response, ResponseSerializer, Serializer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#errorsObject (readonly)

PagSeguro::Errors object.



18
19
20
# File 'lib/pagseguro/refund.rb', line 18

def errors
  @errors
end

#resultObject

Result from request.



15
16
17
# File 'lib/pagseguro/refund.rb', line 15

def result
  @result
end

#transaction_codeObject

Set the transaction code. The transaction status must be: Paga (3), Disponível (4), Em disputa (5)



7
8
9
# File 'lib/pagseguro/refund.rb', line 7

def transaction_code
  @transaction_code
end

#valueObject

Set the refund value. Greater than 0.00 and less or equal than transaction value. If not informed, PagSeguro will assume the total transaction value.



12
13
14
# File 'lib/pagseguro/refund.rb', line 12

def value
  @value
end

Instance Method Details

#registerObject

Calls the PagSeguro webservice and register the refund. Return PagSeguro::Refund.



22
23
24
25
# File 'lib/pagseguro/refund.rb', line 22

def register
  response_request = Request.post("transactions/refunds", api_version, params)
  Response.new(response_request, self).serialize
end

#update_attributes(attrs) ⇒ Object



31
32
33
# File 'lib/pagseguro/refund.rb', line 31

def update_attributes(attrs)
  attrs.map { |name, value| send("#{name}=", value) }
end