Method: MidasClient::Transaction#asynchronous_transaction
- Defined in:
- lib/midas_client/transaction.rb
#asynchronous_transaction(*params) ⇒ Object
This method dispatches a payment transaction creation request, already performing
the authorization and capture in only one step, but sending the response using the informed callback URL, in an asynchronous away.
Params:
externalId: string (Transaction identification on the client application)
externalDate: Date and time form client application - YYYY-MM-DDThh:mm:SS.sssTDZ - ISO8601
cardToken: string (created by method card_store)
cvv: number (Security Code)
softDescriptor: string (Text to be shown on the credit card invoice entry)
amount: number (Only integer numbers, with the last two digits representing the cents.
For example: 100 is equivalent to R$ 1,00)
instalments: number (1 to 12)
callbackUrl: string (URL used to notify the client application about the transaction creation result. )
# Response:
result: {
success: true/false
code: "XXX"
message: "Some message to you"
},
transactionToken: "65ffe2897b832cb89cb2063b74fbb143",
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/midas_client/transaction.rb', line 113 def asynchronous_transaction(*params) # Parametros são recebidos como um array de hash, pego o 1o item do array params = params.first # define o método de envio da requisição method = :post # monta a URL de chamada da requisição endpoint= get_env[:url] + EndPoints::OPERATIONS[:context] + EndPoints::OPERATIONS[:asynchronous_transaction] # regulariza o formato da data params[:externalDate] = (params[:externalDate].blank? ? Time.now.iso8601(1) : params[:externalDate]) # faz a chamada a plataforma de pagamento (MIDAS) request(method, endpoint, self.login, self.password, params) end |