payify 0.1.9 → 0.1.11
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/README.md +164 -0
 - data/app/assets/config/payify_manifest.js +1 -0
 - data/app/assets/images/payify/screenshot.png +0 -0
 - data/app/assets/images/payify/vat.png +0 -0
 - data/app/assets/stylesheets/payify/application.css +15 -0
 - data/app/controllers/payify/payments_controller.rb +29 -0
 - data/app/helpers/payify/application_helper.rb +4 -0
 - data/app/jobs/payify/application_job.rb +4 -0
 - data/app/mailers/payify/application_mailer.rb +6 -0
 - data/app/models/concerns/payify/has_payment_concern.rb +28 -0
 - data/app/models/concerns/payify/stripe_payment_concern.rb +33 -0
 - data/app/models/payify/application_record.rb +5 -0
 - data/app/models/payify/payment.rb +35 -0
 - data/app/serializers/payify/payment_serializer.rb +10 -0
 - data/app/views/payify/application.html.erb +15 -0
 - data/app/views/payify/payments/_form.html.erb +46 -0
 - data/app/views/payify/payments/complete.html.erb +26 -0
 - data/app/views/payify/payments/new.html.erb +24 -0
 - data/config/locales/payify.en.yml +7 -0
 - data/config/routes.rb +8 -0
 - data/db/migrate/20230611124944_create_payment.rb +15 -0
 - data/db/migrate/20230617052430_add_stripe_payment_intent_id.rb +6 -0
 - data/lib/payify/engine.rb +5 -0
 - data/lib/payify/version.rb +5 -0
 - data/lib/payify.rb +25 -0
 - data/lib/stripe/client.rb +31 -0
 - data/lib/tasks/payify_tasks.rake +4 -0
 - metadata +71 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0fa9bb51ecf7e284bbbfc17e69b226c2fbde70ddd52ba0b646a755ce9be2bccb
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0c61fb9bfb43f086482efbf144c45f329f789883c6899d4c0f2db505fb41b9cc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 92d358f5c5e6902d2f1a39069deef60587f2f3fce801a911fd563502019640d0b2cd96c4e0fecc6ced75198b733079bdff64e16635d8162491acbd052076e7e5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 727c3072195112eb5e08c2c4578bcc7fcba2d579e981f4789eb8d515568832839d9793f47d2709fcdd06f07de24c581bb77db90045c68a902b438902cf071b56
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,164 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Payify
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            PayifyRails is a Ruby gem that simplifies payment integration into Ruby on Rails projects. It allows to easily add payment functionality to your models. For example, by applying the HasPaymentConcern to a reservation model, you can manage the payment process for reservations seamlessly.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            To install the gem add it into a Gemfile (Bundler):
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'payify', '~> 0.1.0'
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ```
         
     | 
| 
      
 18 
     | 
    
         
            +
            bundle install
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Features ✅
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            - Includes a Payment model
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Provides concerns to easily add a payment system to your model
         
     | 
| 
      
 25 
     | 
    
         
            +
            - Enables payment with Stripe
         
     | 
| 
      
 26 
     | 
    
         
            +
            - Offers a payment form to integrate into your application
         
     | 
| 
      
 27 
     | 
    
         
            +
            - Allows payment status to be checked via an api route
         
     | 
| 
      
 28 
     | 
    
         
            +
            - Allows configuration of payment (currency, VAT)
         
     | 
| 
      
 29 
     | 
    
         
            +
            - Provides a user interface for payment processing
         
     | 
| 
      
 30 
     | 
    
         
            +
            - Enables management of payment status (pending, paid)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            ## Configuration
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            For now, Payify uses Stripe as the payment gateway. You can configure the currency using an initializer.
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 37 
     | 
    
         
            +
            # initializers/payify.rb
         
     | 
| 
      
 38 
     | 
    
         
            +
            Payify.setup do |config|
         
     | 
| 
      
 39 
     | 
    
         
            +
              config.currency = "usd"
         
     | 
| 
      
 40 
     | 
    
         
            +
              config.default_tax_rates_id = "eur"
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
            ```
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            To handle VAT or different tax rates on your payments, you need to create tax rates on Stripe and define the default_tax_rates_id or, alternatively, define the tax_rates_id method on your payment-related models. Leave it empty if you don't manage any taxes.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            You can set your Stripe API credentials using environment variables. (Secret key, Publishable key)
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 49 
     | 
    
         
            +
            # .env
         
     | 
| 
      
 50 
     | 
    
         
            +
            STRIPE_API_KEY="..."
         
     | 
| 
      
 51 
     | 
    
         
            +
            STRIPE_PUBLISHABLE_KEY="..."
         
     | 
| 
      
 52 
     | 
    
         
            +
            ```
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            To enable payment functionality for a model, simply include the HasPayment concern:
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 59 
     | 
    
         
            +
            class Reservation < ApplicationRecord
         
     | 
| 
      
 60 
     | 
    
         
            +
              include Payify::HasPaymentConcern
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              def amount_to_pay
         
     | 
| 
      
 63 
     | 
    
         
            +
                self.price
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              # Optional : Override the default tax rates id
         
     | 
| 
      
 67 
     | 
    
         
            +
              def tax_rates_id
         
     | 
| 
      
 68 
     | 
    
         
            +
                'txr_1234567890'
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
            end
         
     | 
| 
      
 71 
     | 
    
         
            +
            ```
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            When you want to request a payment for a model on which you added the concern, you just need to call the create_payment method.
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 76 
     | 
    
         
            +
            reservation_1.create_payment
         
     | 
| 
      
 77 
     | 
    
         
            +
            ```
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            Then you can find the id of the new pending payment with payment.id.
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 82 
     | 
    
         
            +
            reservation_1.payment.id
         
     | 
| 
      
 83 
     | 
    
         
            +
            ```
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            Now you just have to redirect the user to `/payments/:id/new` or include the payment form in your page.
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 88 
     | 
    
         
            +
            # reservation/show.html.erb
         
     | 
| 
      
 89 
     | 
    
         
            +
            <%= render "payify/payments/form", payment: @payment %>
         
     | 
| 
      
 90 
     | 
    
         
            +
            ```
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            After completing the payment process, the user will be redirected to:
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            ```
         
     | 
| 
      
 95 
     | 
    
         
            +
            /payments/:id/complete
         
     | 
| 
      
 96 
     | 
    
         
            +
            ```
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
            The application will then verify the payment status with Stripe. You can do it manually calling the following method:
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 101 
     | 
    
         
            +
            @payment.stripe_confirm_payment
         
     | 
| 
      
 102 
     | 
    
         
            +
            ```
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            If the payment has been successfully processed, a confirmation message will be displayed to the user. The payment method `paid?` will return `true`.
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            To customize the page that displays the payment status, you can create the following file:
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 109 
     | 
    
         
            +
            # views/payify/payments/complete.html.erb
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            <% if @payment.paid? %>
         
     | 
| 
      
 112 
     | 
    
         
            +
              <div class="alert alert-success" role="alert">
         
     | 
| 
      
 113 
     | 
    
         
            +
                <%= I18n.t("payments.complete.paid") %>
         
     | 
| 
      
 114 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 115 
     | 
    
         
            +
            <% else %>
         
     | 
| 
      
 116 
     | 
    
         
            +
              <div class="alert alert-danger" role="alert">
         
     | 
| 
      
 117 
     | 
    
         
            +
                <%= I18n.t("payments.complete.pending") %>
         
     | 
| 
      
 118 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 119 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 120 
     | 
    
         
            +
            ```
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            ## API
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
            If you prefer using the Payify API, after creating the payment object, you can initialize a new Stripe payment by making a request to: `/payments/:id/new.json`
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            This request will return a JSON response containing the `stripe_payment_intent_id` and `stripe_client_secret` required to process a payment using Stripe.
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            After making the payment, you can make a request to the following endpoint to update the payment status and retrieve its current state:
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            ```
         
     | 
| 
      
 131 
     | 
    
         
            +
            /payments/:id/complete.json
         
     | 
| 
      
 132 
     | 
    
         
            +
            ```
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
            ## Status
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            You can access the payment status using `@payment.status`. The possible statuses are:
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            - `pending`: The payment is still being processed.
         
     | 
| 
      
 139 
     | 
    
         
            +
            - `paid`: The payment has been successfully completed.
         
     | 
| 
      
 140 
     | 
    
         
            +
            - `failed`: The payment has failed.
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
            ## Tests
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
            To run the tests, execute `rspec` command.
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            You can test the payment process in your web browser by following these steps:
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            1. Navigate to the `test/dummy` directory.
         
     | 
| 
      
 149 
     | 
    
         
            +
            2. Run the following commands:
         
     | 
| 
      
 150 
     | 
    
         
            +
               - `rails db:create`
         
     | 
| 
      
 151 
     | 
    
         
            +
               - `rails db:migrate`
         
     | 
| 
      
 152 
     | 
    
         
            +
               - `rails db:seed`
         
     | 
| 
      
 153 
     | 
    
         
            +
               - `rails s`
         
     | 
| 
      
 154 
     | 
    
         
            +
            3. Open your browser and go to: [http://localhost:3000/](http://localhost:3000/).
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
            Each time you run the seed command, your test database will be reset with a reservation that has a payment with an ID of 1. This allows you to test the payment process at the following address: [http://localhost:3000/payments/1/new](http://localhost:3000/payments/1/new).
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/andrewdsilva/payify.
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            //= link_directory ../stylesheets/payify .css
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*
         
     | 
| 
      
 2 
     | 
    
         
            +
             * This is a manifest file that'll be compiled into application.css, which will include all the files
         
     | 
| 
      
 3 
     | 
    
         
            +
             * listed below.
         
     | 
| 
      
 4 
     | 
    
         
            +
             *
         
     | 
| 
      
 5 
     | 
    
         
            +
             * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
         
     | 
| 
      
 6 
     | 
    
         
            +
             * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
         
     | 
| 
      
 7 
     | 
    
         
            +
             *
         
     | 
| 
      
 8 
     | 
    
         
            +
             * You're free to add application-wide styles to this file and they'll appear at the bottom of the
         
     | 
| 
      
 9 
     | 
    
         
            +
             * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
         
     | 
| 
      
 10 
     | 
    
         
            +
             * files in this directory. Styles in this file should be added after the last require_* statement.
         
     | 
| 
      
 11 
     | 
    
         
            +
             * It is generally better to create a new file per style scope.
         
     | 
| 
      
 12 
     | 
    
         
            +
             *
         
     | 
| 
      
 13 
     | 
    
         
            +
             *= require_tree .
         
     | 
| 
      
 14 
     | 
    
         
            +
             *= require_self
         
     | 
| 
      
 15 
     | 
    
         
            +
             */
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 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
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 2 
     | 
    
         
            +
              module HasPaymentConcern
         
     | 
| 
      
 3 
     | 
    
         
            +
                extend ActiveSupport::Concern
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                included do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  has_one :payment, as: :model, dependent: :destroy, class_name: "Payify::Payment"
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def create_payment
         
     | 
| 
      
 10 
     | 
    
         
            +
                  build_payment(amount: amount_to_pay)
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  payment.save
         
     | 
| 
      
 13 
     | 
    
         
            +
                  payment
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def cancel_payment
         
     | 
| 
      
 17 
     | 
    
         
            +
                  payment.destroy if payment.present?
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def amount_to_pay
         
     | 
| 
      
 21 
     | 
    
         
            +
                  raise NotImplementedError, "The 'amount_to_pay' method must be implemented in the including model."
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                def tax_rates_id
         
     | 
| 
      
 25 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "stripe/client"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 4 
     | 
    
         
            +
              module StripePaymentConcern
         
     | 
| 
      
 5 
     | 
    
         
            +
                extend ActiveSupport::Concern
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def stripe_client
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @stripe_client ||= Stripe::Client.new
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def stripe_init_intent
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return unless stripe_payment_inent_id.nil? && !paid?
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  intent = stripe_client.create_payment_intent(amount, tax_id)
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  update_attribute(:stripe_payment_inent_id, intent.id)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  update_attribute(:stripe_client_secret, intent.client_secret)
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def stripe_confirm_payment
         
     | 
| 
      
 21 
     | 
    
         
            +
                  intent = stripe_client.find_intent(stripe_payment_inent_id)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  return unless intent["status"] == "succeeded"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  update_attribute(:paid_at, Time.now)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  update_attribute(:status, Payify::Payment.statuses[:paid])
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def tax_id
         
     | 
| 
      
 30 
     | 
    
         
            +
                  model&.tax_rates_id || Payify.default_tax_rates_id
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Payment < ApplicationRecord
         
     | 
| 
      
 3 
     | 
    
         
            +
                include ::Payify::StripePaymentConcern
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                enum status: { pending: 0, paid: 1, failed: 2 }
         
     | 
| 
      
 6 
     | 
    
         
            +
                enum payment_method: { stripe: 0 }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                belongs_to :model, polymorphic: true, optional: true
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                validates :amount, presence: true, numericality: { greater_than_or_equal_to: 0 }
         
     | 
| 
      
 11 
     | 
    
         
            +
                validates :status, presence: true
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                before_destroy :cannot_destroy_if_paid
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def make_payment(transaction_id)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  self.transaction_id = transaction_id
         
     | 
| 
      
 17 
     | 
    
         
            +
                  self.paid_at = Time.current
         
     | 
| 
      
 18 
     | 
    
         
            +
                  self.status = :paid
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                def can_destroy?
         
     | 
| 
      
 22 
     | 
    
         
            +
                  !paid?
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def paid?
         
     | 
| 
      
 26 
     | 
    
         
            +
                  paid_at.present?
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                def cannot_destroy_if_paid
         
     | 
| 
      
 32 
     | 
    
         
            +
                  raise ActiveRecord::RecordNotDestroyed if paid?
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 2 
     | 
    
         
            +
              class PaymentSerializer < ActiveModel::Serializer
         
     | 
| 
      
 3 
     | 
    
         
            +
                attributes :id, :amount, :status, :payment_method, :transaction_id, :paid_at
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attributes :stripe_payment_inent_id, :stripe_client_secret
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                attribute(:paid) { object.paid? }
         
     | 
| 
      
 8 
     | 
    
         
            +
                attribute(:can_destroy) { object.can_destroy? }
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <script src="https://js.stripe.com/v3/"></script>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            <%= form_with(id: "payment-form", url: payify.complete_payment_path, method: "post") do |form| %>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <div id="payment-element">
         
     | 
| 
      
 5 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              <div id="error-message">
         
     | 
| 
      
 8 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              <%= form.submit I18n.t("payments.submit"), id: "submit", class: "btn btn-primary w-100 mt-4" %>
         
     | 
| 
      
 11 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <script>
         
     | 
| 
      
 14 
     | 
    
         
            +
              const stripe = Stripe("<%= Payify.stripe_publishable_key %>");
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              const options = {
         
     | 
| 
      
 17 
     | 
    
         
            +
                clientSecret: "<%= payment.stripe_client_secret %>",
         
     | 
| 
      
 18 
     | 
    
         
            +
              };
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              const elements = stripe.elements(options);
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              const paymentElement = elements.create("payment");
         
     | 
| 
      
 23 
     | 
    
         
            +
              paymentElement.mount("#payment-element");
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              const form = document.getElementById("payment-form");
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              form.addEventListener("submit", async (event) => {
         
     | 
| 
      
 28 
     | 
    
         
            +
                event.preventDefault();
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                const {error} = await stripe.confirmPayment({
         
     | 
| 
      
 31 
     | 
    
         
            +
                  elements,
         
     | 
| 
      
 32 
     | 
    
         
            +
                  confirmParams: {
         
     | 
| 
      
 33 
     | 
    
         
            +
                    return_url: "<%= request.base_url %>/payify/payments/<%= payment.id %>/complete",
         
     | 
| 
      
 34 
     | 
    
         
            +
                  },
         
     | 
| 
      
 35 
     | 
    
         
            +
                });
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                if (error) {
         
     | 
| 
      
 38 
     | 
    
         
            +
                  const messageContainer = document.querySelector("#error-message");
         
     | 
| 
      
 39 
     | 
    
         
            +
                  messageContainer.textContent = error.message;
         
     | 
| 
      
 40 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 41 
     | 
    
         
            +
                  // Your customer will be redirected to your `return_url`. For some payment
         
     | 
| 
      
 42 
     | 
    
         
            +
                  // methods like iDEAL, your customer will be redirected to an intermediate
         
     | 
| 
      
 43 
     | 
    
         
            +
                  // site first to authorize the payment, then redirected to the `return_url`.
         
     | 
| 
      
 44 
     | 
    
         
            +
                }
         
     | 
| 
      
 45 
     | 
    
         
            +
              });
         
     | 
| 
      
 46 
     | 
    
         
            +
            </script>
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!doctype html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html lang="en">
         
     | 
| 
      
 3 
     | 
    
         
            +
              <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <meta charset="utf-8">
         
     | 
| 
      
 5 
     | 
    
         
            +
                <meta name="viewport" content="width=device-width, initial-scale=1">
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                <title>Payment</title>
         
     | 
| 
      
 10 
     | 
    
         
            +
              </head>
         
     | 
| 
      
 11 
     | 
    
         
            +
              <body>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                <div class="container py-5 my-5" style="max-width: 500px;">
         
     | 
| 
      
 14 
     | 
    
         
            +
                  <% if @payment.paid? %>
         
     | 
| 
      
 15 
     | 
    
         
            +
                    <div class="alert alert-success" role="alert">
         
     | 
| 
      
 16 
     | 
    
         
            +
                      <%= I18n.t("payments.complete.paid") %>
         
     | 
| 
      
 17 
     | 
    
         
            +
                    </div>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  <% else %>
         
     | 
| 
      
 19 
     | 
    
         
            +
                    <div class="alert alert-danger" role="alert">
         
     | 
| 
      
 20 
     | 
    
         
            +
                      <%= I18n.t("payments.complete.pending") %>
         
     | 
| 
      
 21 
     | 
    
         
            +
                    </div>
         
     | 
| 
      
 22 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 23 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              </body>
         
     | 
| 
      
 26 
     | 
    
         
            +
            </html>
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!doctype html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html lang="en">
         
     | 
| 
      
 3 
     | 
    
         
            +
              <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <meta charset="utf-8">
         
     | 
| 
      
 5 
     | 
    
         
            +
                <meta name="viewport" content="width=device-width, initial-scale=1">
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                <title>Payment</title>
         
     | 
| 
      
 10 
     | 
    
         
            +
              </head>
         
     | 
| 
      
 11 
     | 
    
         
            +
              <body>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                <div class="container py-5 my-5" style="max-width: 500px;">
         
     | 
| 
      
 14 
     | 
    
         
            +
                  <% if @payment.paid? %>
         
     | 
| 
      
 15 
     | 
    
         
            +
                    <div class="alert alert-info" role="alert">
         
     | 
| 
      
 16 
     | 
    
         
            +
                      <%= I18n.t("payments.already_paid") %>
         
     | 
| 
      
 17 
     | 
    
         
            +
                    </div>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  <% else %>
         
     | 
| 
      
 19 
     | 
    
         
            +
                    <%= render "form", payment: @payment %>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 21 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              </body>
         
     | 
| 
      
 24 
     | 
    
         
            +
            </html>
         
     | 
    
        data/config/routes.rb
    ADDED
    
    
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class CreatePayment < ActiveRecord::Migration[7.0]
         
     | 
| 
      
 2 
     | 
    
         
            +
              def change
         
     | 
| 
      
 3 
     | 
    
         
            +
                create_table :payify_payments do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
                  t.decimal :amount, precision: 10, scale: 2, null: false
         
     | 
| 
      
 5 
     | 
    
         
            +
                  t.integer :status, default: 0, null: false
         
     | 
| 
      
 6 
     | 
    
         
            +
                  t.integer :payment_method
         
     | 
| 
      
 7 
     | 
    
         
            +
                  t.string :transaction_id
         
     | 
| 
      
 8 
     | 
    
         
            +
                  t.datetime :paid_at
         
     | 
| 
      
 9 
     | 
    
         
            +
                  t.string :model_type
         
     | 
| 
      
 10 
     | 
    
         
            +
                  t.integer :model_id
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  t.timestamps
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/payify.rb
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative "payify/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "payify/engine"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "dotenv/load"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module Payify
         
     | 
| 
      
 8 
     | 
    
         
            +
              class Error < StandardError; end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              mattr_accessor :currency
         
     | 
| 
      
 11 
     | 
    
         
            +
              @@currency = "usd"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              mattr_accessor :default_tax_rates_id
         
     | 
| 
      
 14 
     | 
    
         
            +
              @@default_tax_rates_id = nil
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              mattr_accessor :stripe_api_key
         
     | 
| 
      
 17 
     | 
    
         
            +
              @@stripe_api_key = ENV["STRIPE_API_KEY"]
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              mattr_accessor :stripe_publishable_key
         
     | 
| 
      
 20 
     | 
    
         
            +
              @@stripe_publishable_key = ENV["STRIPE_PUBLISHABLE_KEY"]
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              def self.setup
         
     | 
| 
      
 23 
     | 
    
         
            +
                yield self
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Stripe
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Client
         
     | 
| 
      
 3 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 4 
     | 
    
         
            +
                  stripe
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  Stripe.api_key = Payify.stripe_api_key
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def stripe
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @stripe ||= Stripe::StripeClient.new
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def create_payment_intent(amount, tax_id = nil, object_invoice = "")
         
     | 
| 
      
 14 
     | 
    
         
            +
                  infos = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                    amount: (amount * 100).to_i,
         
     | 
| 
      
 16 
     | 
    
         
            +
                    currency: Payify.currency,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    description: object_invoice,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    setup_future_usage: "off_session",
         
     | 
| 
      
 19 
     | 
    
         
            +
                    metadata: {
         
     | 
| 
      
 20 
     | 
    
         
            +
                      "tax_id": tax_id
         
     | 
| 
      
 21 
     | 
    
         
            +
                    }
         
     | 
| 
      
 22 
     | 
    
         
            +
                  }
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  Stripe::PaymentIntent.create(infos)
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def find_intent(payment_intent_id)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Stripe::PaymentIntent.retrieve(payment_intent_id)
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.11
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nathan Lopez
         
     | 
| 
         @@ -10,6 +10,34 @@ bindir: exe 
     | 
|
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2023-06-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: dotenv-rails
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 2.8.1
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 2.8.1
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: money
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '6.16'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '6.16'
         
     | 
| 
       13 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
42 
     | 
    
         
             
              name: rails
         
     | 
| 
       15 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -24,6 +52,20 @@ dependencies: 
     | 
|
| 
       24 
52 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
54 
     | 
    
         
             
                    version: '7.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: stripe
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 8.5.0
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 8.5.0
         
     | 
| 
       27 
69 
     | 
    
         
             
            description: Payify is a Ruby gem that simplifies payment integration into Ruby on
         
     | 
| 
       28 
70 
     | 
    
         
             
              Rails projects.
         
     | 
| 
       29 
71 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -31,7 +73,34 @@ email: 
     | 
|
| 
       31 
73 
     | 
    
         
             
            executables: []
         
     | 
| 
       32 
74 
     | 
    
         
             
            extensions: []
         
     | 
| 
       33 
75 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       34 
     | 
    
         
            -
            files: 
     | 
| 
      
 76 
     | 
    
         
            +
            files:
         
     | 
| 
      
 77 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 78 
     | 
    
         
            +
            - app/assets/config/payify_manifest.js
         
     | 
| 
      
 79 
     | 
    
         
            +
            - app/assets/images/payify/screenshot.png
         
     | 
| 
      
 80 
     | 
    
         
            +
            - app/assets/images/payify/vat.png
         
     | 
| 
      
 81 
     | 
    
         
            +
            - app/assets/stylesheets/payify/application.css
         
     | 
| 
      
 82 
     | 
    
         
            +
            - app/controllers/payify/payments_controller.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - app/helpers/payify/application_helper.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - app/jobs/payify/application_job.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - app/mailers/payify/application_mailer.rb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - app/models/concerns/payify/has_payment_concern.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - app/models/concerns/payify/stripe_payment_concern.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - app/models/payify/application_record.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - app/models/payify/payment.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - app/serializers/payify/payment_serializer.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - app/views/payify/application.html.erb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - app/views/payify/payments/_form.html.erb
         
     | 
| 
      
 93 
     | 
    
         
            +
            - app/views/payify/payments/complete.html.erb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - app/views/payify/payments/new.html.erb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - config/locales/payify.en.yml
         
     | 
| 
      
 96 
     | 
    
         
            +
            - config/routes.rb
         
     | 
| 
      
 97 
     | 
    
         
            +
            - db/migrate/20230611124944_create_payment.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - db/migrate/20230617052430_add_stripe_payment_intent_id.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - lib/payify.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/payify/engine.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/payify/version.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/stripe/client.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/tasks/payify_tasks.rake
         
     | 
| 
       35 
104 
     | 
    
         
             
            homepage: https://github.com/andrewdsilva/payify
         
     | 
| 
       36 
105 
     | 
    
         
             
            licenses:
         
     | 
| 
       37 
106 
     | 
    
         
             
            - MIT
         
     |