Class: VSafe::Client
- Inherits:
-
Object
- Object
- VSafe::Client
- Defined in:
- lib/vsafe/client.rb
Constant Summary collapse
- SANDBOX_FINGERPRINT_PATH =
"ThreatMetrixUIRedirector".freeze
- FINGERPRINT_PATH =
"PaySafeUIRedirector".freeze
- REQUEST_CONTENT_TYPE =
"application/json; charset=utf-8".freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #charge_authorize(params) ⇒ Object
- #charge_confirm(params) ⇒ Object
- #charge_sale(params) ⇒ Object
- #fingerprint_url ⇒ Object
- #get_payment_status(params) ⇒ Object
- #get_session_tags ⇒ Object
- #heartbeat ⇒ Object
-
#initialize {|config| ... } ⇒ Client
constructor
A new instance of Client.
- #reverse_payment(params) ⇒ Object
- #service_url(endpoint = nil, jsonp = false) ⇒ Object
- #validate_charge_account(params) ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
21 22 23 |
# File 'lib/vsafe/client.rb', line 21 def config @config end |
Instance Method Details
#charge_authorize(params) ⇒ Object
38 39 40 |
# File 'lib/vsafe/client.rb', line 38 def (params) VSafe::Responses::ChargeAuthorize.new(request(service_url("ChargeAuthorize"), params)) end |
#charge_confirm(params) ⇒ Object
42 43 44 |
# File 'lib/vsafe/client.rb', line 42 def charge_confirm(params) VSafe::Responses::ChargeConfirm.new(request(service_url("ChargeConfirm"), params)) end |
#charge_sale(params) ⇒ Object
54 55 56 |
# File 'lib/vsafe/client.rb', line 54 def charge_sale(params) VSafe::Responses::ChargeSale.new(request(service_url("ChargeSale"), params)) end |
#fingerprint_url ⇒ Object
71 72 73 74 |
# File 'lib/vsafe/client.rb', line 71 def fingerprint_url base_uri = URI.join(config.jsonp_url, '/') @_fingerprint_url ||= URI.join(base_uri, config.sandbox ? SANDBOX_FINGERPRINT_PATH : FINGERPRINT_PATH).to_s end |
#get_payment_status(params) ⇒ Object
62 63 64 |
# File 'lib/vsafe/client.rb', line 62 def get_payment_status(params) VSafe::Responses::GetPaymentStatus.new(request(service_url("GetPaymentStatus"), params)) end |
#get_session_tags ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/vsafe/client.rb', line 30 def params = { TransactionID: SecureRandom.uuid } VSafe::Responses::GetSessionTags.new(request(service_url("GetSessionTags"), params)) end |
#heartbeat ⇒ Object
50 51 52 |
# File 'lib/vsafe/client.rb', line 50 def heartbeat VSafe::Response.new(request(service_url("HeartBeat"))) end |
#reverse_payment(params) ⇒ Object
46 47 48 |
# File 'lib/vsafe/client.rb', line 46 def reverse_payment(params) VSafe::Responses::ReversePayment.new(request(service_url("ReversePayment"), params)) end |
#service_url(endpoint = nil, jsonp = false) ⇒ Object
66 67 68 69 |
# File 'lib/vsafe/client.rb', line 66 def service_url(endpoint = nil, jsonp = false) base_uri = jsonp ? config.jsonp_url : config.url endpoint.nil? ? base_uri : File.join(base_uri, endpoint) end |
#validate_charge_account(params) ⇒ Object
58 59 60 |
# File 'lib/vsafe/client.rb', line 58 def validate_charge_account(params) VSafe::Responses::ValidateChargeAccount.new(request(service_url("ValidateChargeAccount"), params)) end |