Class: Ipizza::Provider::Sampo
- Inherits:
-
Object
- Object
- Ipizza::Provider::Sampo
- Defined in:
- lib/ipizza/provider/sampo.rb
Class Attribute Summary collapse
-
.file_cert ⇒ Object
Returns the value of attribute file_cert.
-
.file_key ⇒ Object
Returns the value of attribute file_key.
-
.key_secret ⇒ Object
Returns the value of attribute key_secret.
-
.lang ⇒ Object
Returns the value of attribute lang.
-
.rec_acc ⇒ Object
Returns the value of attribute rec_acc.
-
.rec_name ⇒ Object
Returns the value of attribute rec_name.
-
.return_url ⇒ Object
Returns the value of attribute return_url.
-
.service_url ⇒ Object
Returns the value of attribute service_url.
-
.snd_id ⇒ Object
Returns the value of attribute snd_id.
Instance Method Summary collapse
Class Attribute Details
.file_cert ⇒ Object
Returns the value of attribute file_cert.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def file_cert @file_cert end |
.file_key ⇒ Object
Returns the value of attribute file_key.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def file_key @file_key end |
.key_secret ⇒ Object
Returns the value of attribute key_secret.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def key_secret @key_secret end |
.lang ⇒ Object
Returns the value of attribute lang.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def lang @lang end |
.rec_acc ⇒ Object
Returns the value of attribute rec_acc.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def rec_acc @rec_acc end |
.rec_name ⇒ Object
Returns the value of attribute rec_name.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def rec_name @rec_name end |
.return_url ⇒ Object
Returns the value of attribute return_url.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def return_url @return_url end |
.service_url ⇒ Object
Returns the value of attribute service_url.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def service_url @service_url end |
.snd_id ⇒ Object
Returns the value of attribute snd_id.
5 6 7 |
# File 'lib/ipizza/provider/sampo.rb', line 5 def snd_id @snd_id end |
Instance Method Details
#payment_request(payment, service = 1002) ⇒ Object
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 40 |
# File 'lib/ipizza/provider/sampo.rb', line 8 def payment_request(payment, service = 1002) req = Ipizza::PaymentRequest.new req.service_url = self.class.service_url req.sign_params = { 'VK_SERVICE' => service.to_s, 'VK_VERSION' => '008', 'VK_SND_ID' => self.class.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. } if service == 1001 req.sign_params['VK_ACC'] = self.class.rec_acc req.sign_params['VK_NAME'] = self.class.rec_name end req.extra_params = { 'VK_RETURN' => self.class.return_url, 'VK_LANG' => self.class.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.class.file_key, self.class.key_secret, param_order) req end |
#payment_response(params) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/ipizza/provider/sampo.rb', line 42 def payment_response(params) response = Ipizza::PaymentResponse.new(params) response.verify(self.class.file_cert) return response end |