przelewy24_payment 0.1.0 → 0.1.1

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.
@@ -2,7 +2,7 @@ class Przelewy24Payment::PaymentController < ActionController::Base
2
2
 
3
3
  def payment
4
4
  @data = {
5
- :session_id => 'sssss',
5
+ :session_id => 'sssss',
6
6
  :description => "opis",
7
7
  :value => '34.3',
8
8
  :client => 'Adam Nowak',
@@ -1,3 +1,3 @@
1
1
  module Przelewy24Payment
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: przelewy24_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -22,27 +22,13 @@ files:
22
22
  - LICENSE.txt
23
23
  - README.md
24
24
  - Rakefile
25
- - app/controllers/.przelewy24_payment_controller.rb.swo
26
- - app/controllers/.przelewy24_payment_controller.rb.swp
27
- - app/controllers/przelewy24_payment/.payment_controller.rb.swp
28
25
  - app/controllers/przelewy24_payment/payment_controller.rb
29
- - app/controllers/przelewy24_payment/payment_controller.rb~
30
- - app/helpers/przelewy24_payment/.payment_helper.rb.swp
31
26
  - app/helpers/przelewy24_payment/payment_helper.rb
32
- - app/views/._p24_payment.html.haml.swp
33
- - app/views/._przelewy24_payment.html.haml.swp
34
27
  - app/views/przelewy24_payment/_payment_form.html.haml
35
- - lib/.przelewy24_payment.rb.swm
36
- - lib/.przelewy24_payment.rb.swn
37
- - lib/.przelewy24_payment.rb.swo
38
- - lib/.przelewy24_payment.rb.swp
39
- - lib/generators/przelewy24_payment/install/.install_generator.rb.swp
40
28
  - lib/generators/przelewy24_payment/install/USAGE
41
29
  - lib/generators/przelewy24_payment/install/install_generator.rb
42
- - lib/generators/przelewy24_payment/install/install_generator.rb~
43
30
  - lib/generators/przelewy24_payment/install/templates/przelewy24_payment.rb
44
31
  - lib/przelewy24_payment.rb
45
- - lib/przelewy24_payment/.version.rb.swp
46
32
  - lib/przelewy24_payment/engine.rb
47
33
  - lib/przelewy24_payment/version.rb
48
34
  - przelewy24_payment.gemspec
@@ -1,62 +0,0 @@
1
- class Przelewy24PaymentController < ApplicationController
2
- def payment
3
- @data = {
4
- :session_id => 'sssss',
5
- :description => "opis",
6
- :value => '34.3',
7
- :client => 'Adam Nowak',
8
- :address => 'Powstancow 22/2',
9
- :zipcode => '53-456',
10
- :city => 'Wroclaw',
11
- :country => 'Polska',
12
- :email => 'test@example.com'
13
- }
14
- end
15
-
16
- def payment_success(payment_params)
17
- end
18
-
19
-
20
- def payment_error(payment_params, code, description)
21
- end
22
-
23
- def payment_verify(response_params)
24
- return data = { :amount => 100.0, :crc_key => '' }
25
- end
26
-
27
- def comeback
28
- @response = przelewy24_verify(params)
29
- result = @response.split("\r\n")
30
- if result[1] == "TRUE"
31
- payment_success(params)
32
- else
33
- payment_error(params, :error_code => result[2], :error_descr => result[3])
34
- end
35
- end
36
-
37
- private
38
-
39
- def przelewy24_verify(params)
40
- require 'net/https'
41
- require 'net/http'
42
- require 'open-uri'
43
- require 'openssl'
44
-
45
- data = payment_verify(params)
46
-
47
- params_new = {:p24_session_id => params[:p24_session_id], :p24_order_id => params[:p24_order_id], :p24_id_sprzedawcy => P24Payment::SELLER_ID, :p24_kwota => P24Payment.p24_price(data[:amount]).to_s}
48
- if data[:crc_key].present?
49
- params_new[:p24_crc] = Digest::MD5.hexdigest(params[:p24_session_id]+"|"+params[:p24_order_id]+"|"+params[:p24_kwota]+"|"+data[:crc_key])
50
- end
51
-
52
- url = URI.parse(P24Payment.transaction_url)
53
- req = Net::HTTP::Post.new(url.path,{"User-Agent" => "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10"})
54
- req.form_data = params_new
55
- con = Net::HTTP.new(url.host, 443)
56
- con.use_ssl = true
57
- con.verify_mode = OpenSSL::SSL::VERIFY_NONE
58
- response = con.start {|http| http.request(req)}
59
- return response.body
60
- end
61
-
62
- end
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,85 +0,0 @@
1
- class CustomizeAdmin::InstallGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
3
-
4
- def add_gems
5
- insert_into_file "Gemfile", :after => "source 'https://rubygems.org'\n" do
6
- "# CustomizeAdmin gems:\n gem 'inherited_resources', '1.3.0'\n gem 'has_scope', '0.5.1'\n gem 'formtastic'\n gem 'will_paginate', '3.0.2'\n gem 'devise', '2.0.0'\n gem 'twitter-bootstrap-rails', '2.1.0' \n gem 'ckeditor', '3.7.1' \n gem 'globalize3' \n \n"
7
- end
8
- end
9
-
10
- def add_routes
11
- insert_into_file "config/routes.rb", :after => "draw do\n" do
12
- @name_space = ask("Tell me the admin namespace?")
13
- " mount CustomizeAdmin::Engine => '/admin', :as => 'customize_admin'\n namespace :#{@name_space} do\n #customize_admin:\n match '/' => 'dashboard#index' \n \n end\n"
14
- end
15
- end
16
-
17
- def create_menu_file
18
- create_file "app/views/customize_admin/application/_admin_menu.html.erb" do
19
- "<%= link_to 'Dashboard', #{@name_space}_path, :class => 'brand' %>
20
- <ul class='nav'>
21
- <li></li>
22
- </ul>
23
- "
24
- end
25
- end
26
-
27
- def run_bootstrap_generator
28
- generate "bootstrap:install"
29
- end
30
-
31
- def install_formtastic
32
- generate "formtastic:install"
33
- end
34
-
35
- def run_devise_generator
36
- generate "devise:install"
37
- end
38
-
39
- def create_admin_user_table
40
- #@devise_name = ask("Tell me devise admin user model (default is AdminUser)")
41
- #@devise_name.blank? ? @devise_name = "AdminUser" : ""
42
- generate "devise AdminUser"
43
- end
44
-
45
- def remove_registerable
46
- model_file = File.join(destination_root, "app", "models", "admin_user.rb")
47
- gsub_file model_file, /\:registerable([.]*,)?/, ""
48
- end
49
-
50
- def admin_user_add_to_migration
51
- inject_into_file Dir["db/migrate/*_devise_create_admin_users.rb"].first,
52
- "# Create a default user\n AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')\n\n ",
53
- :before => "add_index :admin_users, :email"
54
- end
55
-
56
- def add_dashboard
57
- s = ""
58
- @name_space.to_s.split("_").each do |n|
59
- s += n[0].capitalize + n.slice(1..-1)
60
- end
61
- @name_space_class = s
62
- template "dashboard_controller.rb", "app/controllers/#{@name_space}/dashboard_controller.rb"
63
- template "index.html.erb", "app/views/#{@name_space}/dashboard/index.html.erb"
64
- end
65
-
66
- def add_devise_layout
67
- template "devise_admin.html.erb", "app/views/layouts/devise_admin.html.erb"
68
- inject_into_file Dir["app/controllers/application_controller.rb"].first,
69
- "\n layout :layout_by_resource
70
- def layout_by_resource
71
- if devise_controller? && resource_name == :admin_user
72
- 'devise_admin'
73
- else
74
- 'application'
75
- end
76
- end ",
77
- :after => "class ApplicationController < ActionController::Base"
78
-
79
- end
80
-
81
- def add_config
82
- template "customize_admin.rb", "config/initializers/customize_admin.rb"
83
- end
84
-
85
- end
Binary file