payify 0.1.14 → 0.1.16

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: f601e4f2af2f0234b1f350f6104792c7fac0b0ef6ca265e1d38756ca83464dff
4
- data.tar.gz: 30d71b52b41df3111441b53aca66152d1cc7fe17af74aa7c7f0ffef440a2e042
3
+ metadata.gz: 9a9d1ca2475c701c3c4c52cf336fe15f4c4af67bd0bda8881f3e46c6138d4e4b
4
+ data.tar.gz: 5b860f6d917cdf5d8b5c488ff178b4543fe944abafc2678a373a93af2004e9ea
5
5
  SHA512:
6
- metadata.gz: 270e4f3f37f20e8ddb39ef0514bf610a0c6582704bca0a778395305e04ef6cd81390f3c189fa8b18188a324537b8f894fc85428a497f1fc967ce91a8ae0d57fe
7
- data.tar.gz: 44e716493f072dbb9f0c15add3d90a78b31fc65a6292a09a609d2a703b3750872af15393aac6e4864c3394dfb4d685e1ef9d2e61d28e6b31e05fb41f5f9039c7
6
+ metadata.gz: ad029b4c099016f6d332d1174323f8a7a2dc68e43173690651959d20e80310a8feb8d6794b88149608861035d61f1b9decfc1ebd059a2eca97b4fcff797f3a99
7
+ data.tar.gz: 1378445bd65037c4b0593387d25efb9cce4ee738d4546da5f4f8a08105317dbd174deb512b7cb636dc10354df239c072872dd82be4475452548a629512d7c3ff
@@ -0,0 +1,33 @@
1
+ module Payify
2
+ module PaymentsControllerConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_action :set_object, only: %i[new complete]
7
+ end
8
+
9
+ def new
10
+ @payment.stripe_init_intent
11
+
12
+ respond_to do |format|
13
+ format.html
14
+ format.json { render json: @payment }
15
+ end
16
+ end
17
+
18
+ def complete
19
+ @payment.stripe_confirm_payment unless @payment.paid?
20
+
21
+ respond_to do |format|
22
+ format.html
23
+ format.json { render json: @payment }
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def set_object
30
+ @payment = Payment.find(params[:id])
31
+ end
32
+ end
33
+ end
@@ -1,29 +1,5 @@
1
1
  module Payify
2
2
  class PaymentsController < ActionController::Base
3
- before_action :set_object, only: %i[new complete]
4
-
5
- def new
6
- @payment.stripe_init_intent
7
-
8
- respond_to do |format|
9
- format.html
10
- format.json { render json: @payment }
11
- end
12
- end
13
-
14
- def complete
15
- @payment.stripe_confirm_payment unless @payment.paid?
16
-
17
- respond_to do |format|
18
- format.html
19
- format.json { render json: @payment }
20
- end
21
- end
22
-
23
- private
24
-
25
- def set_object
26
- @payment = Payment.find(params[:id])
27
- end
3
+ include ::Payify::PaymentsControllerConcern
28
4
  end
29
5
  end
@@ -1,5 +1,7 @@
1
1
  module Payify
2
2
  class Payment < ApplicationRecord
3
+ self.table_name = "payify_payments"
4
+
3
5
  include ::Payify::StripePaymentConcern
4
6
 
5
7
  enum status: { pending: 0, paid: 1, failed: 2 }
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  ::Payify::Engine.routes.draw do
2
- resources :payments do
2
+ resources :payments, controller: 'payify/payments' do
3
3
  member do
4
4
  get "new"
5
5
  get "complete", as: "complete"
data/lib/payify/engine.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Payify
2
2
  class Engine < ::Rails::Engine
3
- isolate_namespace Payify
4
3
  end
5
4
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Payify
4
- VERSION = "0.1.14"
4
+ VERSION = "0.1.16"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Lopez
@@ -79,6 +79,7 @@ files:
79
79
  - app/assets/images/payify/screenshot.png
80
80
  - app/assets/images/payify/vat.png
81
81
  - app/assets/stylesheets/payify/application.css
82
+ - app/controllers/concerns/payify/payments_controller_concern.rb
82
83
  - app/controllers/payify/payments_controller.rb
83
84
  - app/helpers/payify/application_helper.rb
84
85
  - app/jobs/payify/application_job.rb