Class: Kount::RiskInquiry
Constant Summary collapse
- MODES =
['Q','P','X','U']
- REQUIRED_FIELDS =
[ :anid, # Automatic Number Identification :auth, # A or D, for accept or decline :curr, # Country of currency submitted on order (USD) :emal, # Customer's email :ipad, # IP Address of Customer :mack, # Merchant's acknowledgement to ship/process the order (Y) :merc, # Merchant ID assigned to merchant by Kount :mode, # Q, P, D, U :ptok, # Payment token :ptyp, # Payment type (CARD = Credit Card) :sess, # Unique Session ID :site, # Website Identifier of where order originated :totl, # Total amount in currency (in pennies) :tran, # Kount transaction ID (required for update modes U and X) :vers # Version of Kount ]
- REQUIRED_ARRAY_FIELDS =
[ :prod_type, # High level item descriptions :prod_item, # Typically the SKU :prod_desc, # Specific description :prod_quant, # Quantity of item purchased :prod_price # Price per unit item (in pennies) ]
- OPTIONAL_KEYS =
[ :avst, # AVS Street (M, N, X) :avsz, # AVS Zip (M, N, X) :b2a1, # Billing address line 1 :b2a2, # Billing address Line 2 :b2cc, # Billing address Country :b2ci, # Billing address City :b2pc, # Billing Address Postal Code :b2pn, # Bill-to Phone Number :b2st, # Billing Address State/Province :bpremise, #Bill-to premise for UK :bstreet, # Bill-to street address for UK :cash, # Total cash amount in currency submitted :cvvr, # CVV response (M, N, X) :dob, # Date of birth :epoc, # Date customer account was created by merchant :frmt, # Format of response (XML, JSON, YAML) :gender, # M or F :name, # Name submitted with order :ordr, # Merchant's order number :s2a1, # Shipping street address - Line 1 :s2a2, # Shipping street address - Line 2 :s2cc, # Shipping address - Country :s2ci, # Shipping address - City :s2em, # Shipping address - Email address :s2nm, # Shipping address - Name :s2pc, # Shipping address - Postal Code :s2pn, # Shipping address - Ship-to Phone Number :s2st, # Shipping address - State/Province :shtp, # Shipping type :spremise, # Ship-to premise for UK :sstreet, # Ship-to Street for UK :uniq, # Merchant assigned account number for consumer :uagt # Consumer User-Agent HTTP Header ]
Instance Attribute Summary collapse
-
#custom_fields ⇒ Object
Hash.
Instance Method Summary collapse
-
#initialize ⇒ RiskInquiry
constructor
A new instance of RiskInquiry.
- #payload ⇒ Object
- #request ⇒ Object
Methods inherited from Request
Constructor Details
#initialize ⇒ RiskInquiry
Returns a new instance of RiskInquiry.
68 69 70 71 72 |
# File 'lib/kount/risk_inquiry.rb', line 68 def initialize @merc = Kount.merchant_id @vers = Kount::API_VERSION @custom_fields = {} end |
Instance Attribute Details
#custom_fields ⇒ Object
Hash
66 67 68 |
# File 'lib/kount/risk_inquiry.rb', line 66 def custom_fields @custom_fields end |
Instance Method Details
#payload ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/kount/risk_inquiry.rb', line 74 def payload payload = {} (REQUIRED_FIELDS + OPTIONAL_KEYS).each { |key| payload[key.to_s.upcase] = self.send(key) unless self.send(key).nil? } (REQUIRED_ARRAY_FIELDS).each { |key| payload[[key.to_s.upcase,'[]'].join] = self.send(key) unless self.send(key).nil? } custom_fields.each { |k,v| payload.merge!({ ['UDF[',k.to_s.upcase,']'].join => v }) } payload end |
#request ⇒ Object
88 89 90 |
# File 'lib/kount/risk_inquiry.rb', line 88 def request transmit(:risk,'','post',payload) end |