e4commerce 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +141 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.md +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +60 -0
- data/Rakefile +18 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/e4commerce.gemspec +25 -0
- data/lib/builder.rb +12 -0
- data/lib/e4commerce.rb +11 -0
- data/lib/e4commerce/PagSeguro/pagseguro.rake +3 -0
- data/lib/e4commerce/PagSeguro/pagseguro.rb +0 -0
- data/lib/e4commerce/app/controllers/application_controller.rb +6 -0
- data/lib/e4commerce/app/controllers/pagseguro_controller.rb +32 -0
- data/lib/e4commerce/config/initializers.rb +6 -0
- data/lib/e4commerce/version.rb +3 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 11bba32d43c99a567044072534e32b1812f9c08a
|
4
|
+
data.tar.gz: 1aaa3e0e1c0722ec7eea18b436b915a23738fddc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10a6e5180c4e2f547d34c567cadb0ccfd56a046c9ca987a46515a31d2eae2620525c47578b219bc8489955cba92566c0e1a3af5204a1015ba830d9cc4daa0228
|
7
|
+
data.tar.gz: b280148152866d688c78a68cb634220d9ce0995a3ae01da6468e043b30f87585c81c5fc6e7fbbb2e847dd0a3c2e7d755cb451b061888e17e9188604adf53fedc
|
data/.gitignore
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
|
2
|
+
# Created by https://www.gitignore.io/api/vim,macos,linux,rails,vagrant,sublimetext
|
3
|
+
|
4
|
+
### Linux ###
|
5
|
+
*~
|
6
|
+
|
7
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
8
|
+
.fuse_hidden*
|
9
|
+
|
10
|
+
# KDE directory preferences
|
11
|
+
.directory
|
12
|
+
|
13
|
+
# Linux trash folder which might appear on any partition or disk
|
14
|
+
.Trash-*
|
15
|
+
|
16
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
17
|
+
.nfs*
|
18
|
+
|
19
|
+
### macOS ###
|
20
|
+
*.DS_Store
|
21
|
+
.AppleDouble
|
22
|
+
.LSOverride
|
23
|
+
|
24
|
+
# Icon must end with two \r
|
25
|
+
Icon
|
26
|
+
|
27
|
+
# Thumbnails
|
28
|
+
._*
|
29
|
+
|
30
|
+
# Files that might appear in the root of a volume
|
31
|
+
.DocumentRevisions-V100
|
32
|
+
.fseventsd
|
33
|
+
.Spotlight-V100
|
34
|
+
.TemporaryItems
|
35
|
+
.Trashes
|
36
|
+
.VolumeIcon.icns
|
37
|
+
.com.apple.timemachine.donotpresent
|
38
|
+
|
39
|
+
# Directories potentially created on remote AFP share
|
40
|
+
.AppleDB
|
41
|
+
.AppleDesktop
|
42
|
+
Network Trash Folder
|
43
|
+
Temporary Items
|
44
|
+
.apdisk
|
45
|
+
|
46
|
+
### Rails ###
|
47
|
+
*.rbc
|
48
|
+
*.gem
|
49
|
+
capybara-*.html
|
50
|
+
.rspec
|
51
|
+
/log
|
52
|
+
/tmp
|
53
|
+
/db/*.sqlite3
|
54
|
+
/db/*.sqlite3-journal
|
55
|
+
/public/system
|
56
|
+
/coverage/
|
57
|
+
/spec/tmp
|
58
|
+
*.orig
|
59
|
+
rerun.txt
|
60
|
+
pickle-email-*.html
|
61
|
+
|
62
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
63
|
+
config/initializers/secret_token.rb
|
64
|
+
|
65
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
66
|
+
# config/secrets.yml
|
67
|
+
|
68
|
+
# dotenv
|
69
|
+
# TODO Comment out this rule if environment variables can be committed
|
70
|
+
.env
|
71
|
+
|
72
|
+
## Environment normalization:
|
73
|
+
/.bundle
|
74
|
+
/vendor/bundle
|
75
|
+
|
76
|
+
# these should all be checked in to normalize the environment:
|
77
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
78
|
+
|
79
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
80
|
+
.rvmrc
|
81
|
+
|
82
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
83
|
+
/vendor/assets/bower_components
|
84
|
+
*.bowerrc
|
85
|
+
bower.json
|
86
|
+
|
87
|
+
# Ignore pow environment settings
|
88
|
+
.powenv
|
89
|
+
|
90
|
+
# Ignore Byebug command history file.
|
91
|
+
.byebug_history
|
92
|
+
|
93
|
+
### SublimeText ###
|
94
|
+
# cache files for sublime text
|
95
|
+
*.tmlanguage.cache
|
96
|
+
*.tmPreferences.cache
|
97
|
+
*.stTheme.cache
|
98
|
+
|
99
|
+
# workspace files are user-specific
|
100
|
+
*.sublime-workspace
|
101
|
+
|
102
|
+
# project files should be checked into the repository, unless a significant
|
103
|
+
# proportion of contributors will probably not be using SublimeText
|
104
|
+
# *.sublime-project
|
105
|
+
|
106
|
+
# sftp configuration file
|
107
|
+
sftp-config.json
|
108
|
+
|
109
|
+
# Package control specific files
|
110
|
+
Package Control.last-run
|
111
|
+
Package Control.ca-list
|
112
|
+
Package Control.ca-bundle
|
113
|
+
Package Control.system-ca-bundle
|
114
|
+
Package Control.cache/
|
115
|
+
Package Control.ca-certs/
|
116
|
+
Package Control.merged-ca-bundle
|
117
|
+
Package Control.user-ca-bundle
|
118
|
+
oscrypto-ca-bundle.crt
|
119
|
+
bh_unicode_properties.cache
|
120
|
+
|
121
|
+
# Sublime-github package stores a github token in this file
|
122
|
+
# https://packagecontrol.io/packages/sublime-github
|
123
|
+
GitHub.sublime-settings
|
124
|
+
|
125
|
+
### Vagrant ###
|
126
|
+
.vagrant/
|
127
|
+
|
128
|
+
### Vim ###
|
129
|
+
# swap
|
130
|
+
[._]*.s[a-v][a-z]
|
131
|
+
[._]*.sw[a-p]
|
132
|
+
[._]s[a-v][a-z]
|
133
|
+
[._]sw[a-p]
|
134
|
+
# session
|
135
|
+
Session.vim
|
136
|
+
# temporary
|
137
|
+
.netrwhist
|
138
|
+
# auto-generated tag files
|
139
|
+
tags
|
140
|
+
|
141
|
+
# End of https://www.gitignore.io/api/vim,macos,linux,rails,vagrant,sublimetext
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Miguel Pimentel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Miguel Pimentel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
2
|
+
|
3
|
+
# Framework Desenho de Software Grupo 4
|
4
|
+
|
5
|
+
|
6
|
+
## Sobre o projeto
|
7
|
+
|
8
|
+
<p align="justify">O projeto tem como objetivo a criação de um framework para ser utilizado em projetos que envolvem e-commerce, de forma a oferecer diversas vantagens para quem utilizá-lo.
|
9
|
+
|
10
|
+
## Instalação
|
11
|
+
|
12
|
+
## Licença
|
13
|
+
[MIT](https://opensource.org/licenses/MIT)
|
14
|
+
|
15
|
+
<p align="center">Grupo 4 - Desenho de Software 2017/1<br /><br />
|
16
|
+
<a href="https://fga.unb.br" target="_blank"><img width="200"src="https://4.bp.blogspot.com/-0aa6fAFnSnA/VzICtBQgciI/AAAAAAAARn4/SxVsQPFNeE0fxkCPVgMWbhd5qIEAYCMbwCLcB/s1600/unb-gama.png"></a>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
|
20
|
+
# E4commerce
|
21
|
+
|
22
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/e4commerce`. To experiment with that code, run `bin/console` for an interactive prompt.
|
23
|
+
|
24
|
+
TODO: Delete this and the text above, and describe your gem
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
Add this line to your application's Gemfile:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
gem 'e4commerce'
|
32
|
+
```
|
33
|
+
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
$ bundle
|
37
|
+
|
38
|
+
Or install it yourself as:
|
39
|
+
|
40
|
+
$ gem install e4commerce
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
|
44
|
+
TODO: Write usage instructions here
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
+
|
50
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/e4commerce.
|
55
|
+
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
60
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "e4commerce"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/e4commerce.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'e4commerce/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "e4commerce"
|
8
|
+
spec.version = E4commerce::VERSION
|
9
|
+
spec.authors = ["Miguel Pimentel"]
|
10
|
+
spec.email = ["miguelpimentel2013@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{"Provide e-commerce structure and different payment methods"}
|
13
|
+
spec.homepage = "https://github.com/miguelpimentel/e4commerce"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
data/lib/builder.rb
ADDED
data/lib/e4commerce.rb
ADDED
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CheckoutController < ApplicationController
|
2
|
+
|
3
|
+
def create
|
4
|
+
# O modo como você irá armazenar os produtos que estão sendo comprados
|
5
|
+
# depende de você. Neste caso, temos um modelo Order que referência os
|
6
|
+
# produtos que estão sendo comprados.
|
7
|
+
# Classe para pegar o pedido -> order = Order.find(params[:id])
|
8
|
+
|
9
|
+
payment = PagSeguro::PaymentRequest.new
|
10
|
+
payment.reference = order.id
|
11
|
+
payment.notification_url = notifications_url
|
12
|
+
payment.redirect_url = processing_url
|
13
|
+
|
14
|
+
order.products.each do |product|
|
15
|
+
payment.items << {
|
16
|
+
id: product.id,
|
17
|
+
description: product.title,
|
18
|
+
amount: product.price,
|
19
|
+
weight: product.weight
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
response = payment.register
|
24
|
+
|
25
|
+
if response.errors.any?
|
26
|
+
raise response.errors.join("\n")
|
27
|
+
else
|
28
|
+
redirect_to response.url
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: e4commerce
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Miguel Pimentel
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- miguelpimentel2013@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.md
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
57
|
+
- e4commerce.gemspec
|
58
|
+
- lib/builder.rb
|
59
|
+
- lib/e4commerce.rb
|
60
|
+
- lib/e4commerce/PagSeguro/pagseguro.rake
|
61
|
+
- lib/e4commerce/PagSeguro/pagseguro.rb
|
62
|
+
- lib/e4commerce/app/controllers/application_controller.rb
|
63
|
+
- lib/e4commerce/app/controllers/pagseguro_controller.rb
|
64
|
+
- lib/e4commerce/config/initializers.rb
|
65
|
+
- lib/e4commerce/version.rb
|
66
|
+
homepage: https://github.com/miguelpimentel/e4commerce
|
67
|
+
licenses:
|
68
|
+
- MIT
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.5.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: '"Provide e-commerce structure and different payment methods"'
|
90
|
+
test_files: []
|