Class: Stall::PaymentNotificationService

Inherits:
BaseService show all
Defined in:
app/services/stall/payment_notification_service.rb

Defined Under Namespace

Classes: UnknownNotificationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway_identifier, request) ⇒ PaymentNotificationService

Returns a new instance of PaymentNotificationService.



7
8
9
10
# File 'app/services/stall/payment_notification_service.rb', line 7

def initialize(gateway_identifier, request)
  @gateway_identifier = gateway_identifier
  @request = request
end

Instance Attribute Details

#gateway_identifierObject (readonly)

Returns the value of attribute gateway_identifier.



5
6
7
# File 'app/services/stall/payment_notification_service.rb', line 5

def gateway_identifier
  @gateway_identifier
end

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'app/services/stall/payment_notification_service.rb', line 5

def request
  @request
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'app/services/stall/payment_notification_service.rb', line 12

def call
  if gateway_response.valid?
    validate_cart! if gateway_response.process
  else
    raise UnknownNotificationError,
          "The payment notification request does not seem to come from " +
          "the \"#{ gateway_identifier }\" gateway."
  end
end

#rendering_optionsObject



22
23
24
# File 'app/services/stall/payment_notification_service.rb', line 22

def rendering_options
  gateway_response.rendering_options
end