Class: GpWebpay::Ws::BaseSignedRequest
- Defined in:
- lib/gp_webpay/ws/base_signed_request.rb
Direct Known Subclasses
Services::GetMasterPaymentStatus, Services::GetPaymentStatus, Services::GetTokenStatus, Services::ProcessCancelCapture, Services::ProcessCaptureReverse, Services::ProcessCardOnFilePayment, Services::ProcessMasterPaymentRevoke, Services::ProcessRecurringPayment, Services::ProcessRefundPayment, Services::ProcessTokenPayment, Services::ProcessTokenRevoke, Services::ProcessUsageBasedPayment
Constant Summary collapse
- OPERATION_NAME =
'override_me'.freeze
- REQUEST_NAME =
'override_me'.freeze
- RESPONSE_NAME =
'override_me'.freeze
- RESPONSE_ENTITY_NAME =
'override_me'.freeze
- SERVICE_EXCEPTION =
:service_exception
- DEFAULT_ATTRIBUTES =
{}.freeze
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(attributes, merchant_number: :default) ⇒ BaseSignedRequest
constructor
A new instance of BaseSignedRequest.
Constructor Details
#initialize(attributes, merchant_number: :default) ⇒ BaseSignedRequest
Returns a new instance of BaseSignedRequest.
28 29 30 31 32 33 |
# File 'lib/gp_webpay/ws/base_signed_request.rb', line 28 def initialize(attributes, merchant_number: :default) @attributes = attributes @merchant_number = merchant_number @config = GpWebpay.config[@merchant_number] || GpWebpay.config.default super() end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
19 20 21 |
# File 'lib/gp_webpay/ws/base_signed_request.rb', line 19 def attributes @attributes end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
19 20 21 |
# File 'lib/gp_webpay/ws/base_signed_request.rb', line 19 def config @config end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gp_webpay/ws/base_signed_request.rb', line 35 def call attrs = WsRequest.new(final_attributes).to_gpwebpay Rails.logger.debug([self.class::OPERATION_NAME, { message: { self.class::REQUEST_NAME => attributes_with_signature(attrs) } }]) res = client.call(self.class::OPERATION_NAME, { message: { self.class::REQUEST_NAME => attributes_with_signature(attrs) } }) WsResponse.from_success(res.body, self.class::RESPONSE_NAME, self.class::RESPONSE_ENTITY_NAME, config.merchant_number) rescue Savon::HTTPError => e rescue_from_http(e) rescue Savon::SOAPFault => e rescue_from_soap(e) end |