9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/workers/payments/pay_worker.rb', line 9
def perform(payment_id)
payment = Payment.find(payment_id)
response = RestClient.post "#{Terminal.config.host}/payments/#{payment.foreign_id}/pay",
:provider => payment.provider.keyword,
:terminal => Terminal.config.keyword,
:payment => {
:meta => payment.meta,
:paid_amount => payment.paid_amount,
:card_track1 => payment.card_track1,
:card_track2 => payment.card_track2
}
Sidekiq::Logging.logger.debug "Pay response: #{response.to_s}"
payment.update_attributes(
:processed => true,
:card_track1 => nil,
:card_track2 => nil
) if response
end
|