Sha256: 7a31c57acd62cba2c321c0cebee0a51e3ffe461df61f17585e6c32f7d4506103
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
module Ipizza::Provider class Sampo class << self attr_accessor :service_url, :return_url, :file_key, :key_secret, :file_cert, :snd_id, :lang, :rec_acc, :rec_name end def payment_request(payment, service = 1002) req = Ipizza::PaymentRequest.new req.service_url = self.service_url req.sign_params = { 'VK_SERVICE' => service.to_s, 'VK_VERSION' => '008', 'VK_SND_ID' => self.snd_id, 'VK_STAMP' => payment.stamp, 'VK_AMOUNT' => sprintf('%.2f', payment.amount), 'VK_CURR' => payment.currency, 'VK_REF' => Ipizza::Util.sign_731(payment.refnum), 'VK_MSG' => payment.message } if service == 1001 req.sign_params['VK_ACC'] = self.rec_acc req.sign_params['VK_NAME'] = self.rec_name end req.extra_params = { 'VK_RETURN' => self.return_url, 'VK_LANG' => self.lang } if service == 1001 param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_ACC', 'VK_NAME', 'VK_REF', 'VK_MSG'] else param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG'] end req.sign(self.key, self.key_secret, param_order) req end def payment_response(params) response = Ipizza::PaymentResponse.new(params, Ipizza::Util::SAMPO) response.verify(cert) return response end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ipizza-0.4.2 | lib/ipizza/provider/sampo.rb |
ipizza-0.4.1 | lib/ipizza/provider/sampo.rb |
ipizza-0.4.0 | lib/ipizza/provider/sampo.rb |