paypal_express_checkout 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8f775071572b304a85419400b695d669c4f43a45
4
+ data.tar.gz: 130114bd2a906b517a40ed50ea45a92d8080dcd2
5
+ SHA512:
6
+ metadata.gz: aad4f3c22e8d0b2a171c7c1b64713e3178089e8d1287e82506553be5991ef4148cf3a672dcf77b744c21d755d2e8a73b77caf327acc4047df492bfb912f6967c
7
+ data.tar.gz: c9d1b0deeeb6980e62bad327b6495ae12a69cca9c40d48c7cdec40c9081738f1cb0333818942e191a11022a5971a8f0dc8dd574e55c1012f0102886559b77898
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in paypal_express_checkout.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Ivan Velasquez
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.
@@ -0,0 +1,103 @@
1
+ # Paypal Express Checkout
2
+ [![Build Status](https://travis-ci.org/chukitow/paypal-express-checkout.svg?branch=master)](https://travis-ci.org/chukitow/paypal-express-checkout)
3
+
4
+ Simple handler for PayPal Express Checkout
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'paypal_express_checkout'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install paypal_express_checkout
21
+
22
+ ## Usage
23
+
24
+ ```ruby
25
+ PaypalExpressCheckout.sanbox! # enables sandbox in development or test
26
+
27
+ # Check the configuration options
28
+ PaypalExpressCheckout.configure({
29
+ business: '<YOUR PAYPAL ACCOUNT EMAIL>',
30
+ return: '<RETURN URL AFTER SUCCESS PURCHASE>',
31
+ cancel_return: '<URL TO REDIRECT WHEN PURCHASE IS CANCEL>',
32
+ notify_url: '<URL WHERE IPN WOULD SEND PURCHASE INFORMATION>'
33
+ })
34
+
35
+ PaypalExpressCheckout.add_product({
36
+ name: "My awesome product name",
37
+ amount: 15, # Product's price
38
+ quantity: 3,
39
+ number: 1242, #SKU
40
+ })
41
+
42
+ redirect_to PaypalExpressCheckout.payment_url # generate the url that the user need to be redirected to complete the purchase
43
+ ```
44
+
45
+ # Confiruation options
46
+
47
+ ###### Account information
48
+ * ***business***: account email or id
49
+
50
+ ###### Custom variable here we send the billing code
51
+ * ***custom***: custom data
52
+ * ***invoice***: code to identify the bill
53
+
54
+ ###### API configuration ###
55
+ * ***currency_code***: "USD" e.g, check the full list here http://bit.ly/anciiH
56
+
57
+ ###### Page Layout
58
+ * ***cpp_header_image***: Image header url [750 pixels wide by 90 pixels high]
59
+ * ***cpp_cart_border_color***: The HTML hex code for your principal identifying color
60
+
61
+ ###### Payment Page Information
62
+ * ***return***: The URL to which PayPal redirects buyers after they complete their payments.
63
+ * ***cancel_return***: Specify a URL on your website that displays payment cancelation page
64
+ * ***notify_url***: The URL to which PayPal posts information about the payment (IPN)
65
+ * ***lc***: Languaje [En,Es] - default En
66
+
67
+
68
+ ###### Shipping and Misc Information
69
+ * ***shipping***
70
+ * ***shipping2***
71
+ * ***handling***
72
+ * ***tax***
73
+ * ***discount_amount_cart***: Discount amount [9.99]
74
+ * ***discount_rate_cart***: Discount percentage [15]
75
+
76
+ ###### Customer Information
77
+ * ***first_name***
78
+ * ***last_name***
79
+ * ***address1***
80
+ * ***address2***
81
+ * ***city***
82
+ * ***state***
83
+ * ***zip***
84
+ * ***email***
85
+ * ***night_phone_a***
86
+ * ***night_phone_b***
87
+ * ***night_phone_c***
88
+
89
+ ## Development
90
+
91
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
92
+
93
+ 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).
94
+
95
+ ## Contributing
96
+
97
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chukitow/paypal_express_checkout.
98
+
99
+
100
+ ## License
101
+
102
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
103
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "paypal_express_checkout"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,93 @@
1
+ require "paypal_express_checkout/version"
2
+ require 'active_support/core_ext/hash'
3
+
4
+ module PaypalExpressCheckout
5
+ ENDPOINT = {
6
+ production: 'https://www.paypal.com/cgi-bin/webscr?',
7
+ sandbox: 'https://www.sandbox.paypal.com/cgi-bin/webscr?'
8
+ }
9
+
10
+ def self.endpoint
11
+ sandbox? ? PaypalExpressCheckout::ENDPOINT[:sandbox] : PaypalExpressCheckout::ENDPOINT[:production]
12
+ end
13
+
14
+ def self.sandbox?
15
+ @@sandbox
16
+ end
17
+
18
+ def self.sandbox!
19
+ self.sandbox = true
20
+ end
21
+
22
+ def self.sandbox=(boolean)
23
+ @@sandbox = boolean
24
+ end
25
+
26
+ def self.configure(options = {})
27
+ #Account information
28
+ @@config[:business] = '' #Account email or id
29
+ @@config[:cmd] = '_cart' #Do not modify
30
+
31
+ #Custom variable here we send the billing code-->
32
+ @@config[:custom] = ''
33
+ @@config[:invoice] = '' #Code to identify the bill
34
+
35
+ #API Configuration
36
+ @@config[:upload] = '1' #Do not modify
37
+ @@config[:currency_code] = 'USD' #http://bit.ly/anciiH
38
+ @@config[:disp_tot] = 'Y'
39
+
40
+ #Page Layout
41
+ @@config[:cpp_header_image] = '' #Image header url [750 pixels wide by 90 pixels high]
42
+ @@config[:cpp_cart_border_color] = '000' #The HTML hex code for your principal identifying color
43
+ @@config[:no_note] = 1 #[0,1] 0 show, 1 hide
44
+
45
+ #Payment Page Information
46
+ @@config[:return] = '' #The URL to which PayPal redirects buyers’ browser after they complete their payments.
47
+ @@config[:cancel_return] = '' #Specify a URL on your website that displays a “Payment Canceled” page.
48
+ @@config[:notify_url] = '' #The URL to which PayPal posts information about the payment (IPN)
49
+ @@config[:rm] = '2' #Leave this to get payment information
50
+ @@config[:lc] = 'En' #Languaje [EN,ES]
51
+
52
+ #Shipping and Misc Information
53
+ @@config[:shipping] = ''
54
+ @@config[:shipping2] = ''
55
+ @@config[:handling] = ''
56
+ @@config[:tax] = ''
57
+ @@config[:discount_amount_cart] = 0 #Discount amount [9.99]
58
+ @@config[:discount_rate_cart] = '' #Discount percentage [15]
59
+
60
+ #Customer Information
61
+ @@config[:first_name] = '';
62
+ @@config[:last_name] = '';
63
+ @@config[:address1] = '';
64
+ @@config[:address2] = '';
65
+ @@config[:city] = '';
66
+ @@config[:state] = '';
67
+ @@config[:zip] = '';
68
+ @@config[:email] = '';
69
+ @@config[:night_phone_a] = '';
70
+ @@config[:night_phone_b] = '';
71
+ @@config[:night_phone_c] = '';
72
+
73
+ options.each do |key, val|
74
+ @@config[key.to_sym] = val
75
+ end
76
+ end
77
+
78
+ def self.add_product(item)
79
+ @@config["item_name_#{@@item}".to_sym] = item[:name]
80
+ @@config["amount_#{@@item}".to_sym] = item[:amount]
81
+ @@config["quantity_#{@@item}".to_sym] = item[:quantity]
82
+ @@config["item_number_#{@@item}".to_sym] = item[:number]
83
+ @@item+= 1
84
+ end
85
+
86
+ def self.payment_url
87
+ "#{self.endpoint}#{@@config.to_query}"
88
+ end
89
+
90
+ self.sandbox = false
91
+ @@config = {}
92
+ @@item = 1;
93
+ end
@@ -0,0 +1,3 @@
1
+ module PaypalExpressCheckout
2
+ VERSION = "0.1.1"
3
+ end
@@ -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 'paypal_express_checkout/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "paypal_express_checkout"
8
+ spec.version = PaypalExpressCheckout::VERSION
9
+ spec.authors = ["Ivan Velasquez"]
10
+ spec.email = ["ivan.velasquez.rios@gmail.com"]
11
+
12
+ spec.summary = %q{Paypal express checkout gem}
13
+ spec.description = %q{Simple hanlder for Paypal express checkout}
14
+ spec.homepage = "https://github.com/chukitow/paypal-express-checkout"
15
+ spec.license = "MIT"
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "activesupport", ">= 4.0.1"
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: paypal_express_checkout
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Velasquez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Simple hanlder for Paypal express checkout
70
+ email:
71
+ - ivan.velasquez.rios@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - lib/paypal_express_checkout.rb
86
+ - lib/paypal_express_checkout/version.rb
87
+ - paypal_express_checkout.gemspec
88
+ homepage: https://github.com/chukitow/paypal-express-checkout
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.5.1
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Paypal express checkout gem
112
+ test_files: []