forked from heavenstudio/spree_pag_seguro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9182b22
commit 9e6e6e6
Showing
3 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.0.beta24 | ||
1.0.0.beta25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Spree | ||
class PaymentMethod::PagSeguroMethod < PaymentMethod | ||
def actions | ||
%w{capture void} | ||
end | ||
|
||
# Indicates whether its possible to capture the payment | ||
def can_capture?(payment) | ||
['checkout', 'pending'].include?(payment.state) | ||
end | ||
|
||
# Indicates whether its possible to void the payment. | ||
def can_void?(payment) | ||
payment.state != 'void' | ||
end | ||
|
||
def capture(payment) | ||
payment.update_attribute(:state, 'pending') if payment.state == 'checkout' | ||
payment.complete | ||
true | ||
end | ||
|
||
def void(payment) | ||
payment.update_attribute(:state, 'pending') if payment.state == 'checkout' | ||
payment.void | ||
true | ||
end | ||
|
||
def source_required? | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters