-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from bookmebus/227-refactor-pre-auth-for-othe…
…r-payment-method close #227 refactor pre auth for other payment method
- Loading branch information
Showing
8 changed files
with
61 additions
and
23 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
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
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
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
17 changes: 17 additions & 0 deletions
17
app/overrides/spree/admin/payment_methods/_form/enable_pre_auth_field.html.erb.deface
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,17 @@ | ||
<!-- insert_after "[data-hook='active']" --> | ||
|
||
<% if @payment_method.support_pre_auth? %> | ||
<div class="form-group"> | ||
<strong><%= Spree.t(:enable_pre_auth) %></strong> | ||
|
||
<div class="form-check my-2"> | ||
<%= radio_button :payment_method, :enable_pre_auth, true, id: 'payment_method_enable_pre_auth_true', class: 'form-check-input' %> | ||
<%= label_tag 'payment_method_enable_pre_auth_true', Spree.t(:say_yes), class: 'form-check-label' %> | ||
</div> | ||
|
||
<div class="form-check my-2"> | ||
<%= radio_button :payment_method, :enable_pre_auth, false, id: 'payment_method_enable_pre_auth_false', class: 'form-check-input' %> | ||
<%= label_tag 'payment_method_enable_pre_auth_false', Spree.t(:say_no), class: 'form-check-label' %> | ||
</div> | ||
</div> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Vpago | ||
module PaywayV2 | ||
class PreAuthHandler | ||
def capture_pre_auth(payment) | ||
Vpago::PaywayV2::PreAuthCompleter.new(payment).call | ||
end | ||
|
||
def cancel_pre_auth(payment) | ||
Vpago::PaywayV2::PreAuthCanceler.new(payment).call | ||
end | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20241202104014_add_enable_pre_auth_to_spree_payment_method.rb
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,5 @@ | ||
class AddEnablePreAuthToSpreePaymentMethod < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :spree_payment_methods, :enable_pre_auth, :boolean, default: false, if_not_exists: true | ||
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