paykassa 0.1.2 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dcdc2aceb8d1bac9c1b6bbb89a55a5b756f9bc9e0600204991bea31ff7e6150
4
- data.tar.gz: 6ae43dbd1f900b1dff6964e5f04078d3ce61989a7cfb62027fbaebd8d3f35ace
3
+ metadata.gz: e5b2f4e36c9dc2f7cece9acef9244b198e7137b59723089fd3d6c0387f961fe1
4
+ data.tar.gz: ab64534aa56630e37f457c95ad98d06345b9f61061db48461e57da5be87c487b
5
5
  SHA512:
6
- metadata.gz: a36b71e58fc19aaa7f536ea17872de7ecfef4a0182dd2664fe98edd3cf384bc6ab3a85051f82f56883c73000f0f8c0fe0f68628acc80c5bf6926039fad3bf517
7
- data.tar.gz: 93ebc1c4c570767cfb998580ae8682144356c64282440ee517fe8cd06d77cd3c4e020c0d09961ce4a55ce43eec845ea7c79474bb1bca06425feee774e018ea75
6
+ metadata.gz: 93e815ffd6c6cdf4b624cbdb0b3396ce098b3dfe49ef5133520a1a6a4c41c45ef5d5d57d175759bed01acfcd723fa468ef3cb69daf23f336405f7cedfe45bffd
7
+ data.tar.gz: 11a8fb9d2daa53cbbc3dd96723656f47f1bebf6383265fdbab1d8ac9851e8aa488daa27548bcecd0350e8cb9f1a238ba6d68c4d5127ab0553614bc4ef05c4203
data/lib/paykassa/pay.rb CHANGED
@@ -58,16 +58,20 @@ class PaykassaPay
58
58
  if !CURRENCIES.include? out
59
59
  raise "#{out} not include in currencies: #{CURRENCIES}"
60
60
  end
61
- make_request(
61
+ data = {
62
62
  currency_in: inn,
63
- currency_out: out,
63
+ currency_out: out
64
+ }
65
+ make_request(
66
+ nil,
67
+ data,
64
68
  false,
65
69
  RATE_URL
66
70
  )
67
71
  end
68
72
  private
69
73
  def make_request(func,data,merge_auth = true, url= nil)
70
- data = data.merge({func: func})
74
+ data = data.merge({func: func}) if func
71
75
  data = data.merge(@_auth) if merge_auth
72
76
  url = BASE_SCI_URI if url.nil?
73
77
  res = Net::HTTP.post_form(url, data)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paykassa
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/paykassa.rb CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  require_relative "paykassa/version"
4
4
  require_relative "paykassa/order"
5
+ require_relative "paykassa/pay"
5
6
  module Paykassa
6
7
  class Error < StandardError; end
7
8
  class Paykassa
8
- def initialize(domain, sci_id, sci_key, api_id = nil, api_key = nil, test)
9
+ def initialize(domain:, sci_id:, sci_key:, api_id: nil, api_key: nil, test:)
9
10
  @paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key})
10
11
  if api_id.nil?
11
12
  @paykassa_pay = nil
@@ -17,6 +18,7 @@ module Paykassa
17
18
  )
18
19
  end
19
20
  end
21
+
20
22
  def pay(amount: , shop: , currency: , system_name: , paid_commission: "shop", number:, tag:, priority:)
21
23
  raise "api_key not present!" if @paykassa_pay.nil?
22
24
  @paykassa_pay.pay({
@@ -30,6 +32,7 @@ module Paykassa
30
32
  priority: priority
31
33
  })
32
34
  end
35
+
33
36
  def balance(shop:)
34
37
  raise "api_key not present!" if @paykassa_pay.nil?
35
38
  @paykassa_pay.balance(shop: shop)
@@ -37,10 +40,8 @@ module Paykassa
37
40
  def rate(c_in, c_out)
38
41
  @paykassa_pay.currency_rate(c_in, c_out)
39
42
  end
40
- def create_order(amount:, currency:, order_id:, system:, comment:)
41
- create_order(amount, currency, order_id, system, comment)
42
- end
43
- def create_order(amount, currency, order_id, system, comment="from paykassa gem")
43
+
44
+ def create_order(amount:, currency:, order_id:, system:, comment: "from paykassa gem")
44
45
  order = @paykassa_order.create_order(
45
46
  amount: amount,
46
47
  currency: currency,
@@ -51,7 +52,7 @@ module Paykassa
51
52
  raise StandardError.new(order[:message]) if order[:error]
52
53
  url = order[:data][:url]
53
54
  end
54
- def confirm_order(hash)
55
+ def confirm_order(hash:)
55
56
  result = @paykassa_order.confirm_order(hash)
56
57
  raise StandardError.new(result[:message]) if result[:error]
57
58
  order_id = res[:data][:order_id]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paykassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - nottewae