bloom_remit 0.2.1 → 0.3.0
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/concepts/bloom_remit/txns/contracts/create.rb +3 -0
- data/app/services/bloom_remit/create_txn.rb +10 -1
- data/app/services/bloom_remit/txns/post.rb +1 -0
- data/db/migrate/20160808081300_add_external_id_to_txns.rb +6 -0
- data/lib/bloom_remit/factories/txn.rb +1 -0
- data/lib/bloom_remit/version.rb +1 -1
- data/spec/concepts/bloom_remit/txns/contracts/create_spec.rb +16 -0
- data/spec/concepts/bloom_remit/txns/operations/create_spec.rb +3 -0
- data/spec/dummy/db/schema.rb +3 -1
- data/spec/dummy/log/development.log +80 -0
- data/spec/dummy/log/test.log +935 -0
- data/spec/requests/api/v1/txns_spec.rb +0 -1
- data/spec/services/bloom_remit/create_txn_spec.rb +4 -0
- data/spec/services/bloom_remit/txns/post_spec.rb +3 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 531182e14ce01cc26b8d22289c39e93b166e1e86
|
4
|
+
data.tar.gz: 8d1888fe7681b257dd8db0660241a4dd7cd513ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68751ada937788bda344ab7e7ee27f08442b87f056cc2621db0163f4631041c719140ca08bacd5fba2da3f6c989d68e800baa80fc0c97e9c2c6164f2fec4440
|
7
|
+
data.tar.gz: 375a3ccba4528c9f026377c0aa9ad32abff5b88c46f93b2bd6e4e6f66a81111677f7fb46da2484b3f2daaa1728d787c38e1ad58cb679439975dba09f40c80614
|
@@ -1,7 +1,15 @@
|
|
1
1
|
module BloomRemit
|
2
2
|
class CreateTxn
|
3
3
|
|
4
|
-
def self.call(
|
4
|
+
def self.call(
|
5
|
+
target_slug:,
|
6
|
+
sender:,
|
7
|
+
owner:,
|
8
|
+
amount:,
|
9
|
+
account_name:,
|
10
|
+
account_id:,
|
11
|
+
external_id:
|
12
|
+
)
|
5
13
|
Txns::Operations::Create.(txn: {
|
6
14
|
sender_id: sender.id,
|
7
15
|
sender_type: sender.class.base_class.name,
|
@@ -11,6 +19,7 @@ module BloomRemit
|
|
11
19
|
target_slug: target_slug,
|
12
20
|
owner_id: owner.id,
|
13
21
|
owner_type: owner.class.base_class.name,
|
22
|
+
external_id: external_id,
|
14
23
|
})
|
15
24
|
end
|
16
25
|
|
data/lib/bloom_remit/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module BloomRemit
|
4
|
+
module Txns
|
5
|
+
module Contracts
|
6
|
+
RSpec.describe Create, type: %i[model] do
|
7
|
+
|
8
|
+
describe "validations" do
|
9
|
+
subject { described_class.new(Txn.new) }
|
10
|
+
it { is_expected.to validate_presence_of(:external_id) }
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -8,6 +8,7 @@ module BloomRemit
|
|
8
8
|
let(:user) { create(:bloom_remit_dummy_sub_user) }
|
9
9
|
let(:biller) { create(:bloom_remit_dummy_biller, slug: "PLDT") }
|
10
10
|
let(:payment) { create(:bloom_remit_dummy_sub_payment) }
|
11
|
+
let(:external_id) { SecureRandom.hex(12) }
|
11
12
|
|
12
13
|
it "creates a txn with a secret and enqueues the PayoutJob" do
|
13
14
|
op = described_class.(txn: {
|
@@ -19,6 +20,7 @@ module BloomRemit
|
|
19
20
|
account_id: "Hooli X",
|
20
21
|
owner_id: payment.id,
|
21
22
|
owner_type: payment.class.base_class.name,
|
23
|
+
external_id: external_id,
|
22
24
|
})
|
23
25
|
txn = op.model
|
24
26
|
expect(txn.target_slug).to eq biller.slug
|
@@ -27,6 +29,7 @@ module BloomRemit
|
|
27
29
|
expect(txn.account_name).to eq "028109090"
|
28
30
|
expect(txn.account_id).to eq "Hooli X"
|
29
31
|
expect(txn.owner).to eq payment
|
32
|
+
expect(txn.external_id).to eq external_id
|
30
33
|
expect(PayoutJob).to have_enqueued_job(txn.id)
|
31
34
|
end
|
32
35
|
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160808081300) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -40,8 +40,10 @@ ActiveRecord::Schema.define(version: 20160806054012) do
|
|
40
40
|
t.string "target_slug", null: false
|
41
41
|
t.string "owner_id"
|
42
42
|
t.string "owner_type"
|
43
|
+
t.string "external_id", null: false
|
43
44
|
end
|
44
45
|
|
46
|
+
add_index "bloom_remit_txns", ["external_id"], name: "index_bloom_remit_txns_on_external_id", using: :btree
|
45
47
|
add_index "bloom_remit_txns", ["owner_id", "owner_type"], name: "index_bloom_remit_txns_on_owner_id_and_owner_type", using: :btree
|
46
48
|
|
47
49
|
create_table "payments", force: :cascade do |t|
|
@@ -1630,4 +1630,84 @@ WHERE c.contype = 'f'
|
|
1630
1630
|
AND t1.relname = 'users'
|
1631
1631
|
AND t3.nspname = ANY (current_schemas(false))
|
1632
1632
|
ORDER BY c.conname
|
1633
|
+
[0m
|
1634
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1635
|
+
Migrating to AddExternalIdToTxns (20160808081300)
|
1636
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1637
|
+
[1m[36m (14.0ms)[0m [1mALTER TABLE "bloom_remit_txns" ADD "external_id" character varying NOT NULL[0m
|
1638
|
+
[1m[35m (8.8ms)[0m CREATE INDEX "index_bloom_remit_txns_on_external_id" ON "bloom_remit_txns" ("external_id")
|
1639
|
+
[1m[36mSQL (1.7ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20160808081300"]]
|
1640
|
+
[1m[35m (0.6ms)[0m COMMIT
|
1641
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1642
|
+
[1m[35m (2.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1643
|
+
FROM pg_constraint c
|
1644
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1645
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1646
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1647
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1648
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1649
|
+
WHERE c.contype = 'f'
|
1650
|
+
AND t1.relname = 'billers'
|
1651
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1652
|
+
ORDER BY c.conname
|
1653
|
+
|
1654
|
+
[1m[36m (1.9ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1655
|
+
FROM pg_constraint c
|
1656
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1657
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1658
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1659
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1660
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1661
|
+
WHERE c.contype = 'f'
|
1662
|
+
AND t1.relname = 'bloom_remit_billers'
|
1663
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1664
|
+
ORDER BY c.conname
|
1665
|
+
[0m
|
1666
|
+
[1m[35m (2.0ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1667
|
+
FROM pg_constraint c
|
1668
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1669
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1670
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1671
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1672
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1673
|
+
WHERE c.contype = 'f'
|
1674
|
+
AND t1.relname = 'bloom_remit_responses'
|
1675
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1676
|
+
ORDER BY c.conname
|
1677
|
+
|
1678
|
+
[1m[36m (2.5ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1679
|
+
FROM pg_constraint c
|
1680
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1681
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1682
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1683
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1684
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1685
|
+
WHERE c.contype = 'f'
|
1686
|
+
AND t1.relname = 'bloom_remit_txns'
|
1687
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1688
|
+
ORDER BY c.conname
|
1689
|
+
[0m
|
1690
|
+
[1m[35m (1.9ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1691
|
+
FROM pg_constraint c
|
1692
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1693
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1694
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1695
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1696
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1697
|
+
WHERE c.contype = 'f'
|
1698
|
+
AND t1.relname = 'payments'
|
1699
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1700
|
+
ORDER BY c.conname
|
1701
|
+
|
1702
|
+
[1m[36m (2.3ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
1703
|
+
FROM pg_constraint c
|
1704
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
1705
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
1706
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
1707
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
1708
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
1709
|
+
WHERE c.contype = 'f'
|
1710
|
+
AND t1.relname = 'users'
|
1711
|
+
AND t3.nspname = ANY (current_schemas(false))
|
1712
|
+
ORDER BY c.conname
|
1633
1713
|
[0m
|