8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/payr/client.rb', line 8
def get_paybox_params_from params
raise ArgumentError if params[:command_id].nil? || params[:buyer_email].nil? || params[:total_price].nil?
raise ArgumentError if params[:callbacks].nil?
command_timestamp = Time.now.utc.iso8601
returned_hash = { pbx_site: Payr.site_id,
pbx_rang: Payr.rang,
pbx_identifiant: Payr.paybox_id,
pbx_total: params[:total_price],
pbx_devise: convert_currency,
pbx_cmd: params[:command_id],
pbx_porteur: params[:buyer_email],
pbx_retour: build_return_variables(Payr.callback_values),
pbx_hash: Payr.hash.upcase,
pbx_time: command_timestamp }
returned_hash.merge!(pbx_effectue: params[:callbacks][:paid],
pbx_refuse: params[:callbacks][:refused],
pbx_annule: params[:callbacks][:cancelled])
returned_hash.merge!(pbx_repondre_a: params[:callbacks][:ipn])
returned_hash.merge!(pbx_typepaiement: Payr.typepaiement,
pbx_typepcarte: Payr.typecard) unless Payr.typepaiement.nil? || Payr.typecard.nil?
returned_hash.merge! params[:options] unless params[:options].blank?
base_params = self.to_base_params(returned_hash)
returned_hash.merge(pbx_hmac: self.generate_hmac(base_params))
end
|