bscf-core 0.4.91 → 0.4.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/bscf/core/user.rb +17 -0
- data/app/models/bscf/core/user_profile.rb +14 -0
- data/app/services/bscf/core/gebeta_maps_service.rb +5 -6
- data/lib/bscf/core/version.rb +1 -1
- data/spec/factories/bscf/core/vouchers.rb +3 -3
- metadata +1 -2
- data/spec/factories/bscf/core/voucher.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caf13fcd9c55c2d3a97ed96ee53be38d65c404a99a373c5a62d026974c7c5c38
|
4
|
+
data.tar.gz: c16574794bda4a63054ecc962824f8f37e2d595271268758a03e96f1b39a355d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4d69dfa72bf6f79c0c63afc7157a301472761a3fad021d555b9e9ff1e59df86f7c0fb0c85bb97f502d8bb0a6e8a742f0ef4e0f30852f47acadac63fcc95fb9a
|
7
|
+
data.tar.gz: d16043f66aa0b14741ea5b65201c991168b460f6dce22625fc59391f9ee1c5aed05b69062a4fba303b8017e53079a8030f433f1e1c897310d8f67ea97a546f76
|
@@ -28,11 +28,28 @@ module Bscf
|
|
28
28
|
},
|
29
29
|
if: :password_required?
|
30
30
|
|
31
|
+
after_create :create_virtual_account
|
32
|
+
|
31
33
|
private
|
32
34
|
|
33
35
|
def password_required?
|
34
36
|
new_record? || password.present?
|
35
37
|
end
|
38
|
+
|
39
|
+
def create_virtual_account
|
40
|
+
VirtualAccount.create!(
|
41
|
+
user: self,
|
42
|
+
branch_code: "VA001",
|
43
|
+
product_scheme: "SAVINGS",
|
44
|
+
voucher_type: "REGULAR",
|
45
|
+
balance: 0.0,
|
46
|
+
locked_amount: 0.0,
|
47
|
+
interest_rate: 2.5,
|
48
|
+
interest_type: :simple,
|
49
|
+
status: :pending,
|
50
|
+
cbs_account_number: "CBS#{SecureRandom.hex(4).upcase}"
|
51
|
+
)
|
52
|
+
end
|
36
53
|
end
|
37
54
|
end
|
38
55
|
end
|
@@ -19,6 +19,20 @@ module Bscf
|
|
19
19
|
approved: 1,
|
20
20
|
rejected: 2
|
21
21
|
}
|
22
|
+
|
23
|
+
after_save :update_virtual_account_status, if: :saved_change_to_kyc_status?
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def update_virtual_account_status
|
28
|
+
return unless user&.virtual_account.present?
|
29
|
+
|
30
|
+
if kyc_status == 'approved'
|
31
|
+
user.virtual_account.update(status: :active)
|
32
|
+
elsif kyc_status == 'rejected'
|
33
|
+
user.virtual_account.update(status: :suspended)
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
end
|
24
38
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
1
3
|
module Bscf
|
2
4
|
module Core
|
3
5
|
class GebetaMapsService
|
@@ -19,11 +21,8 @@ module Bscf
|
|
19
21
|
destinations_str = destinations.map { |lat, lon| "{#{lat},#{lon}}" }.join(",")
|
20
22
|
json_param = "[#{destinations_str}]"
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
json: json_param,
|
25
|
-
apiKey: @api_key
|
26
|
-
})
|
24
|
+
url = "https://mapapi.gebeta.app/api/route/onm?origin=#{origin_str}&json=#{json_param}&apiKey=#{@api_key}"
|
25
|
+
response = HTTParty.get(url)
|
27
26
|
|
28
27
|
handle_response(response)
|
29
28
|
end
|
@@ -34,7 +33,7 @@ module Bscf
|
|
34
33
|
if response.success?
|
35
34
|
JSON.parse(response.body)
|
36
35
|
else
|
37
|
-
Rails.logger.error("
|
36
|
+
Rails.logger.error("Gebeta Maps API error: #{response.code} - #{response.body}")
|
38
37
|
{}
|
39
38
|
end
|
40
39
|
end
|
data/lib/bscf/core/version.rb
CHANGED
@@ -2,13 +2,13 @@ FactoryBot.define do
|
|
2
2
|
factory :voucher, class: 'Bscf::Core::Voucher' do
|
3
3
|
association :issued_by, factory: :user
|
4
4
|
|
5
|
-
|
6
|
-
create(:virtual_account, user: voucher.issued_by, balance:
|
5
|
+
before(:create) do |voucher|
|
6
|
+
create(:virtual_account, user: voucher.issued_by, balance: 10000.0)
|
7
7
|
end
|
8
8
|
|
9
9
|
full_name { Faker::Name.name }
|
10
10
|
phone_number { Faker::PhoneNumber.cell_phone }
|
11
|
-
amount {
|
11
|
+
amount { 100 }
|
12
12
|
expires_at { 30.days.from_now }
|
13
13
|
status { :pending }
|
14
14
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bscf-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.92
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asrat
|
@@ -394,7 +394,6 @@ files:
|
|
394
394
|
- spec/factories/bscf/core/vehicles.rb
|
395
395
|
- spec/factories/bscf/core/virtual_account_transactions.rb
|
396
396
|
- spec/factories/bscf/core/virtual_accounts.rb
|
397
|
-
- spec/factories/bscf/core/voucher.rb
|
398
397
|
- spec/factories/bscf/core/vouchers.rb
|
399
398
|
- spec/factories/bscf/core/wholesaler_products.rb
|
400
399
|
homepage: https://mksaddis.com/
|
File without changes
|