lib/payanyway/request/check.rb in payanyway-2.3.0 vs lib/payanyway/request/check.rb in payanyway-2.3.1
- old
+ new
@@ -41,11 +41,11 @@
end
def response(attr)
# Возвращает Nokogiri::XML документ
# * _attr[:amount] - сумма заказа
- # * _attr[:state] - статус платежа(см. RESPONSE_CODE)
+ # * _attr[:state] - статус платежа (см. RESPONSE_CODE)
# * _attr[:description] - Произвольное описание заказа (необязятельно)
# * _attr[:attributes] - Произвольный атрибуты заказа (необязятельно)
validate_status!(attr[:state])
@@ -61,12 +61,11 @@
end
private
def validate_status!(state)
- if RESPONSE_CODE.keys.exclude?(state.to_sym)
- raise Payanyway::Response::InvalidState.new("PAYANYWAY: Invalid response state! State must be eq #{ RESPONSE_CODE.keys }")
- end
+ return if RESPONSE_CODE.keys.include?(state.to_s.to_sym)
+ raise Payanyway::Response::InvalidState.new("PAYANYWAY: Invalid response state! State must be eq #{ RESPONSE_CODE.keys }")
end
def base_xml(amount, state, description)
xml = <<-EOXML
<MNT_RESPONSE>