comee_core 0.2.5 → 0.2.6

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: 709ba512de5167e177d2bd3590f8e63cfc327736b9701763cf43da56e55ec1b7
4
- data.tar.gz: d5a59cda7b72aa7eb070d3fe7e8dac183aa037aed22e950023d22912801991c0
3
+ metadata.gz: 96fca3f74e6642e5c3724443f279cdeb58217aa89d6aef57f9a67f6fde3757c4
4
+ data.tar.gz: dc819ee771048da328d51512915be23ea2b433432fdaee9fe988109fe2698a14
5
5
  SHA512:
6
- metadata.gz: ee1d492b05abb3e6e2ec223931ffee4616a3c3894a8b707dd0ae3e4bc8930e57c532860ed2084cd43beea39d2b7a3ba427ac29ca650b13e4ec8ea77b098dc786
7
- data.tar.gz: facd7621610fa761f80e0137743eb9ad6b66d090fd0c5264f82e123141b468808e1e7059c76fc64a4f55e0b32b3f4af32e4612fad123a6f351a8ebadfdc8f1bc
6
+ metadata.gz: 38f4ec48d09c65eba8b4e4a7bdb6cede0279ceeac08a97358125860c5cf49ed2564cb03366aaccb8b8c4f47e8df900f2ffeb819e4112e5b1721a2104cffbe143
7
+ data.tar.gz: a75a0a0b023ce9971086f81ca4b6f030a008d018abe048bb67cd0efdd25a88f6c2f9d2a0609cc061f9063cb4e994ddcddd1a996ed5d6de5b26fa9b1be9a322c7
@@ -18,6 +18,10 @@ module Comee
18
18
  render json: result
19
19
  end
20
20
 
21
+ def render_error(error)
22
+ render json: {success: false, error: error.message}, status: :unprocessable_entity
23
+ end
24
+
21
25
  def current_user
22
26
  return if token.nil?
23
27
 
@@ -8,7 +8,7 @@ module Comee
8
8
 
9
9
  has_noticed_notifications model_name: "Comee::Core::Notification"
10
10
 
11
- enum :status, {draft: 0, approved: 1}
11
+ enum :status, {draft: 0, approved: 1, issued: 2}
12
12
  enum :payment_status, {not_paid: 0, partially_paid: 1, fully_paid: 2, overpaid: 3}
13
13
 
14
14
  validates :invoice_no, presence: true, uniqueness: true
@@ -0,0 +1,11 @@
1
+ module Comee
2
+ module Core
3
+ class Payment < ApplicationRecord
4
+ belongs_to :invoice
5
+ belongs_to :currency
6
+
7
+ validates :reference_no, :payment_date, :amount, presence: true
8
+ validates :amount, numericality: {greater_than: 0}
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ class CreateComeeCorePayments < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_payments do |t|
4
+ t.string :reference_no, null: false
5
+ t.references :invoice,
6
+ null: false,
7
+ index: {name: "invoice_on_ccp_indx"},
8
+ foreign_key: {to_table: :comee_core_invoices}
9
+ t.date :payment_date, null: false
10
+ t.float :amount, null: false
11
+ t.references :currency,
12
+ null: false,
13
+ index: {name: "currency_on_ccp_indx"},
14
+ foreign_key: {to_table: :comee_core_currencies}
15
+ t.string :bank_reference
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.5".freeze
3
+ VERSION = "0.2.6".freeze
4
4
  end
5
5
  end
@@ -14,5 +14,9 @@ FactoryBot.define do
14
14
  trait :approved do
15
15
  status { Comee::Core::Invoice.statuses[:approved] }
16
16
  end
17
+
18
+ trait :issued do
19
+ status { Comee::Core::Invoice.statuses[:issued] }
20
+ end
17
21
  end
18
22
  end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :payment, class: "Comee::Core::Payment" do
3
+ reference_no { Faker::Alphanumeric.alpha(number: 10) }
4
+ invoice
5
+ payment_date { Date.current }
6
+ amount { 100 }
7
+ currency
8
+ bank_reference { Faker::Alphanumeric.alpha(number: 10) }
9
+ end
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-24 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -324,6 +324,7 @@ files:
324
324
  - app/models/comee/core/master_price.rb
325
325
  - app/models/comee/core/notification.rb
326
326
  - app/models/comee/core/order_source.rb
327
+ - app/models/comee/core/payment.rb
327
328
  - app/models/comee/core/pickup_schedule.rb
328
329
  - app/models/comee/core/pod.rb
329
330
  - app/models/comee/core/price.rb
@@ -431,6 +432,7 @@ files:
431
432
  - db/migrate/20240111112140_create_comee_core_pickup_schedules.rb
432
433
  - db/migrate/20240119100125_create_comee_core_client_warehouses.rb
433
434
  - db/migrate/20240124161320_create_comee_core_additional_items.rb
435
+ - db/migrate/20240125044630_create_comee_core_payments.rb
434
436
  - lib/comee/core.rb
435
437
  - lib/comee/core/engine.rb
436
438
  - lib/comee/core/version.rb
@@ -460,6 +462,7 @@ files:
460
462
  - spec/factories/comee/core/master_prices.rb
461
463
  - spec/factories/comee/core/notifications.rb
462
464
  - spec/factories/comee/core/order_sources.rb
465
+ - spec/factories/comee/core/payments.rb
463
466
  - spec/factories/comee/core/pickup_schedules.rb
464
467
  - spec/factories/comee/core/pods.rb
465
468
  - spec/factories/comee/core/product_lookups.rb