Class: Redex::Request::BaseRequest
- Inherits:
-
Object
- Object
- Redex::Request::BaseRequest
show all
- Defined in:
- lib/redex/request/base_request.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.client ⇒ Object
3
4
5
|
# File 'lib/redex/request/base_request.rb', line 3
def self.client
@client ||= CannedSoap::Client.new(Redex.service_url)
end
|
Instance Method Details
#authorization_params ⇒ Object
7
8
9
10
11
12
|
# File 'lib/redex/request/base_request.rb', line 7
def authorization_params
{
Filiacao: Redex.secret_pv.to_s,
Senha: Redex.secret_token.to_s
}
end
|
#result ⇒ Object
14
15
16
|
# File 'lib/redex/request/base_request.rb', line 14
def result
@result ||= do_request
end
|
#sanitize(field) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/redex/request/base_request.rb', line 18
def sanitize(field)
return nil if send(field).nil?
return "%.2f" % send(field) if [:amount].include?(field)
return "%02d" % send(field) if [:installments, :card_expiration_month, :origin].include?(field)
return card_expiration_year_sanitized if [:card_expiration_year].include?(field)
return send(field) ? "1" : "0" if [:recorrence].include?(field)
return send(field).to_s if [:order_id, :credit_card_authorization_id, :sequential_id, :transaction_id, :card_number].include?(field)
return send(field).strftime("%Y%m%d") if [:transaction_date].include?(field)
send(field)
end
|