lib/tres_delta/gateway.rb in tres_delta-0.0.1 vs lib/tres_delta/gateway.rb in tres_delta-0.0.2

- old
+ new

@@ -2,10 +2,33 @@ class Gateway < Client def initialize @wsdl = Config.config['transaction_wsdl'] end + def authorize(transaction_key, credit_card, amount, order_number, customer) + request :authorize, authorize_params(transaction_key, credit_card, amount, order_number, customer) + end + + def authorize_params(transaction_key, credit_card, amount, order_number, customer) + { + 'clientCredentials' => client_credentials, + 'authorizeParams' => { + 'AddOrUpdateCard' => 'true', + 'CreditCardTransaction' => { + 'CreditCard' => credit_card_params(credit_card), + 'CurrencyCode' => 'USDollars', + 'StoredCardIdentifier' => { + 'CustomerCode' => customer.vault_key + }, + 'TotalAmount' => amount, + 'TransactionKey' => transaction_key + }, + 'TerminalIdentifier' => terminal_identifier + } + } + end + def card_verification(transaction_key, credit_card) request(:card_verification, card_verification_params(transaction_key, credit_card)) end def card_verification_params(transaction_key, credit_card) @@ -51,11 +74,8 @@ { namespaces: { 'xmlns:cc' => 'http://schemas.datacontract.org/2004/07/ThreeDelta.Web.Services.ECLinx.Definitions' } } - end - - def authorize(transaction_key, credit_card, transaction_total, order_number) end end end