Class: Payment::Gateways::Default

Inherits:
BasePaymentGateway
  • Object
show all
Defined in:
app/services/payment/gateways/default.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(payment, _delivery = nil) ⇒ Default

Returns a new instance of Default.



6
7
8
9
10
# File 'app/services/payment/gateways/default.rb', line 6

def initialize(payment, _delivery = nil)
  @payment = payment
  success = nil
  message = nil
end

Instance Method Details

#authorizeObject



12
13
14
15
# File 'app/services/payment/gateways/default.rb', line 12

def authorize
  @payment.payment_authorized!
  Result.new(success: true)
end

#capture(params1 = nil, options = {}) ⇒ Object

Raises:

  • (StandardError)


28
29
30
# File 'app/services/payment/gateways/default.rb', line 28

def capture(params1=nil, options = {})
  raise StandardError, "Payment 'Capture' action reached but not supported. Payment ID #{@payment.id}"
end

#credit(params1 = nil) ⇒ Object

Raises:

  • (StandardError)


40
41
42
# File 'app/services/payment/gateways/default.rb', line 40

def credit(params1=nil)
  raise StandardError, "Payment 'Credit' action reached but not supported. Payment ID #{@payment.id}"
end

#purchase(params1 = nil, options = {}) ⇒ Object

Raises:

  • (StandardError)


32
33
34
# File 'app/services/payment/gateways/default.rb', line 32

def purchase(params1=nil, options = {})
  raise StandardError, "Payment 'Purchase' action reached but not supported. Payment ID #{@payment.id}"
end

#reauthorize(params1 = nil) ⇒ Object

Raises:

  • (StandardError)


36
37
38
# File 'app/services/payment/gateways/default.rb', line 36

def reauthorize(params1=nil)
  raise StandardError, "Payment 'Reauthorize' action reached but not supported. Payment ID #{@payment.id}"
end

#refund(params1 = nil, params2 = nil) ⇒ Object

Raises:

  • (StandardError)


24
25
26
# File 'app/services/payment/gateways/default.rb', line 24

def refund(params1=nil, params2=nil)
  raise StandardError, "Payment 'Refund' action reached but not supported. Payment ID #{@payment.id}"
end

#void(report_fraud = false) ⇒ Object



17
18
19
20
21
22
# File 'app/services/payment/gateways/default.rb', line 17

def void(report_fraud = false)
  return Result.new(success: false) unless @payment.authorized?

  @payment.payment_voided!
  Result.new(success: true)
end