active_merchant_payline 0.1.2 → 0.2.0

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.
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.authors = ["Ludovic Galabru"]
13
13
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
14
  gem.add_dependency 'activemerchant', '>= 1.9.0'
15
+ gem.add_dependency 'builder'
15
16
  end
16
17
  Jeweler::GemcutterTasks.new
17
18
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_merchant_payline}
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ludovic Galabru"]
12
- s.date = %q{2010-11-02}
12
+ s.date = %q{2010-11-08}
13
13
  s.description = %q{A plugin for Payline support in Active Merchant.}
14
14
  s.email = %q{ludovic@scrumers.com}
15
15
  s.extra_rdoc_files = [
@@ -25,6 +25,11 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "active_merchant_payline.gemspec",
27
27
  "lib/active_merchant_payline.rb",
28
+ "lib/active_merchant_payline/gateway/payline.rb",
29
+ "lib/active_merchant_payline/integration/lib/helper.rb",
30
+ "lib/active_merchant_payline/integration/lib/notification.rb",
31
+ "lib/active_merchant_payline/integration/lib/return.rb",
32
+ "lib/active_merchant_payline/integration/payline.rb",
28
33
  "test/helper.rb",
29
34
  "test/test_active_merchant_payline.rb"
30
35
  ]
@@ -45,13 +50,16 @@ Gem::Specification.new do |s|
45
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
51
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
52
  s.add_runtime_dependency(%q<activemerchant>, [">= 1.9.0"])
53
+ s.add_runtime_dependency(%q<builder>, [">= 0"])
48
54
  else
49
55
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
50
56
  s.add_dependency(%q<activemerchant>, [">= 1.9.0"])
57
+ s.add_dependency(%q<builder>, [">= 0"])
51
58
  end
52
59
  else
53
60
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
54
61
  s.add_dependency(%q<activemerchant>, [">= 1.9.0"])
62
+ s.add_dependency(%q<builder>, [">= 0"])
55
63
  end
56
64
  end
57
65
 
@@ -1,38 +1,5 @@
1
1
  require 'active_merchant'
2
-
3
-
4
- module ActiveMerchant
5
- module Billing
6
- module Integrations
7
- module Payline
8
-
9
- def mock_request
10
- build_request
11
- end
12
-
13
- def build_request(body, options)
14
- xml = Builder::XmlMarkup.new :indent => 2
15
- xml.instruct!
16
- xml.tag! 's:Envelope', {'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/'} do
17
- xml.tag! 's:Header' do
18
- xml.tag! 'wsse:Security', {'s:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'} do
19
- xml.tag! 'wsse:UsernameToken' do
20
- xml.tag! 'wsse:Username', @options[:login]
21
- xml.tag! 'wsse:Password', @options[:password], 'Type' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'
22
- end
23
- end
24
- end
25
- xml.tag! 's:Body', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
26
- xml.tag! 'requestMessage', {'xmlns' => 'urn:schemas-cybersource-com:transaction-data-1.32'} do
27
- add_merchant_data(xml, options)
28
- xml << body
29
- end
30
- end
31
- end
32
- xml.target!
33
- end
34
-
35
- end
36
- end
37
- end
38
- end
2
+ require 'integration/payline'
3
+ require 'gateway/payline'
4
+ require 'net/http'
5
+ require 'net/https'
@@ -0,0 +1,7 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ class PaylineGateway < Gateway
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Payline
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Payline
5
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
6
+
7
+ def method_name
8
+
9
+ end
10
+
11
+ def parse(post)
12
+
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Payline
5
+ class Return < ActiveMerchant::Billing::Integrations::Return
6
+
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,127 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ module Integrations
4
+ module Payline
5
+ autoload :Helper, File.dirname(__FILE__) + '/lib/helper.rb'
6
+ autoload :Return, File.dirname(__FILE__) + '/lib/return.rb'
7
+ autoload :Notification, File.dirname(__FILE__) + '/lib/notification.rb'
8
+
9
+ # Overwrite this if you want to change the Payline homologation url
10
+ mattr_accessor :homologation_url
11
+ self.homologation_url = 'https://homologation.payline.com/V4/services/DirectPaymentAPI'
12
+
13
+ # Overwrite this if you want to change the Payline production url
14
+ mattr_accessor :production_url
15
+ self.production_url = 'https://services.payline.com/V4/services/DirectPaymentAPI'
16
+
17
+ def self.service_url
18
+ mode = ActiveMerchant::Billing::Base.integration_mode
19
+ case mode
20
+ when :production
21
+ self.production_url
22
+ when :test
23
+ self.homologation_url
24
+ else
25
+ raise StandardError, "Integration mode set to an invalid value: #{mode}"
26
+ end
27
+ end
28
+
29
+ def self.notification(post)
30
+ Notification.new(post)
31
+ end
32
+
33
+ def self.return(query_string, options = {})
34
+ Return.new(query_string)
35
+ end
36
+
37
+ def build_do_web_payment
38
+ xml= Builder::XmlMarkup.new
39
+ xml.instruct!
40
+ xmlns= {
41
+ 'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/',
42
+ 'xmlns:impl' => 'http://impl.ws.payline.experian.com',
43
+ 'xmlns:obj' => 'http://obj.ws.payline.experian.com'
44
+ }
45
+ xml.tag! "soapenv:Envelope", xmlns do
46
+ xml.tag! "soapenv:Header"
47
+ xml.tag! "soapenv:Body" do
48
+ do_web_payment_envelope(xml)
49
+ end
50
+ end
51
+
52
+ http = Net::HTTP.new(self.service_url, 443)
53
+ http.use_ssl = true
54
+ data = xml.target!
55
+ resp, data = http.post(path, data)
56
+ puts resp.inspect
57
+ puts data.inspect
58
+ end
59
+
60
+ private
61
+ def do_web_payment_envelope(xml)
62
+ xml.tag! 'impl:doWebPaymentRequest' do
63
+ xml.tag! 'impl:securityMode' do
64
+ xml.text! 'SSL'
65
+ end
66
+ xml.tag! 'impl:languageCode'
67
+ xml.tag! 'impl:customPaymentPageCode' do
68
+ end
69
+ add_urls(xml)
70
+ add_payment(xml)
71
+ add_order(xml)
72
+ add_contract(xml)
73
+ add_buyer(xml)
74
+ end
75
+ xml
76
+ end
77
+
78
+ private
79
+ def add_urls(xml)
80
+ xml.tag! 'impl:returnURL' do
81
+
82
+ end
83
+ xml.tag! 'impl:cancelURL' do
84
+
85
+ end
86
+ xml.tag! 'impl:notificationURL' do
87
+
88
+ end
89
+ xml.tag! 'impl:customPaymentTemplateURL' do
90
+
91
+ end
92
+ xml
93
+ end
94
+
95
+ def add_payment(xml)
96
+ xml.tag! 'impl:payment' do
97
+
98
+ end
99
+ end
100
+
101
+ private
102
+ def add_order(xml)
103
+ xml.tag! 'impl:order' do
104
+
105
+ end
106
+ end
107
+
108
+ private
109
+ def add_contract(xml)
110
+ xml.tag! 'impl:contract' do
111
+
112
+ end
113
+ end
114
+
115
+ private
116
+ def add_buyer(xml)
117
+ xml.tag! 'impl:buyer' do
118
+
119
+ end
120
+ end
121
+
122
+
123
+
124
+ end
125
+ end
126
+ end
127
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ludovic Galabru
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-02 00:00:00 +01:00
17
+ date: 2010-11-08 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,19 @@ dependencies:
45
45
  version: 1.9.0
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: builder
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ type: :runtime
60
+ version_requirements: *id003
48
61
  description: A plugin for Payline support in Active Merchant.
49
62
  email: ludovic@scrumers.com
50
63
  executables: []
@@ -63,6 +76,11 @@ files:
63
76
  - VERSION
64
77
  - active_merchant_payline.gemspec
65
78
  - lib/active_merchant_payline.rb
79
+ - lib/active_merchant_payline/gateway/payline.rb
80
+ - lib/active_merchant_payline/integration/lib/helper.rb
81
+ - lib/active_merchant_payline/integration/lib/notification.rb
82
+ - lib/active_merchant_payline/integration/lib/return.rb
83
+ - lib/active_merchant_payline/integration/payline.rb
66
84
  - test/helper.rb
67
85
  - test/test_active_merchant_payline.rb
68
86
  has_rdoc: true