Class: PaymentMethod::Paybright
- Inherits:
-
Spree::PaymentMethod
- Object
- Spree::PaymentMethod
- PaymentMethod::Paybright
- Defined in:
- app/models/spree/payment_method/paybright.rb
Instance Method Summary collapse
-
#actions ⇒ Array<String>
The actions available on this payment method.
- #auto_capture ⇒ Object
- #credit(amount_in_cents, transaction_id, _gateway_options = {}) ⇒ Object
- #payment_source_class ⇒ Object
- #redirect_url(payment) ⇒ Object
- #source_required? ⇒ Boolean
- #void(transaction_id, _gateway_options = {}) ⇒ Object
Instance Method Details
#actions ⇒ Array<String>
Returns the actions available on this payment method.
22 23 24 |
# File 'app/models/spree/payment_method/paybright.rb', line 22 def actions %w(void credit) end |
#auto_capture ⇒ Object
17 18 19 |
# File 'app/models/spree/payment_method/paybright.rb', line 17 def auto_capture false end |
#credit(amount_in_cents, transaction_id, _gateway_options = {}) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/models/spree/payment_method/paybright.rb', line 48 def credit(amount_in_cents, transaction_id, = {}) if api_client.refund!(transaction_id, amount_in_cents / 100.0) response( true, Spree.t("paybright.successful_action", action: "credit", id: transaction_id) ) else response( false, Spree.t("paybright.unsuccessful_action", action: "credit", id: transaction_id) ) end end |
#payment_source_class ⇒ Object
9 10 11 |
# File 'app/models/spree/payment_method/paybright.rb', line 9 def payment_source_class nil end |
#redirect_url(payment) ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/models/spree/payment_method/paybright.rb', line 26 def redirect_url(payment) uri = URI.parse(paybright_redirect_url) params = SolidusPaybright::ParamsHelper.new(payment).build_redirect_params uri.query = params.to_query uri.to_s end |
#source_required? ⇒ Boolean
13 14 15 |
# File 'app/models/spree/payment_method/paybright.rb', line 13 def source_required? false end |
#void(transaction_id, _gateway_options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/spree/payment_method/paybright.rb', line 34 def void(transaction_id, = {}) if api_client.void!(transaction_id) response( true, Spree.t("paybright.successful_action", action: "void", id: transaction_id) ) else response( false, Spree.t("paybright.unsuccessful_action", action: "void", id: transaction_id) ) end end |