ZuoraHpm 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.
- checksums.yaml +4 -4
- data/lib/ZuoraHpm.rb +81 -58
- data/lib/ZuoraHpm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9007fdb82d1072caec77ec8cf0fdf590c29aab2c9a96bbd6ddc0205b5e11cc40
|
|
4
|
+
data.tar.gz: 6518c4f338b7250524a6fe89858516df61dd14136e10d6cf99736b884ee69d6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12acba7c2cdf8e581af782c06c014bef13160fc9d07a23ff54068fcd17092b315ec97960bc03300ced947b7e6d96afb2698461c4853c14c3ababaaaced57bfba
|
|
7
|
+
data.tar.gz: 9d4d63eb3da681f55ba2a5b5347be18c46563ccb1a1874328b60d82bcca9c5049e94d604021d122d2b170839c8d1b12ba15bf479f1c641cfee90f20112f2ddf3
|
data/lib/ZuoraHpm.rb
CHANGED
|
@@ -3,29 +3,88 @@ require "ZuoraHpm/version"
|
|
|
3
3
|
module ZuoraHpm
|
|
4
4
|
class Error < StandardError; end
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
#default values
|
|
7
|
+
@locale = 'en'
|
|
8
|
+
@param_supportedTypes = "AmericanExpress,JCB,Visa,MasterCard,Discover,Dankort"
|
|
9
|
+
@style= "overlay"
|
|
10
|
+
@submitEnabled = true
|
|
11
|
+
@url = 'https://rest.apisandbox.zuora.com/v1/rsa-signatures'
|
|
12
|
+
@uri = 'https://apisandbox.zuora.com/apps/PublicHostedPageLite.do'
|
|
13
|
+
|
|
14
|
+
def self.set_username=(username)
|
|
7
15
|
@username = username
|
|
8
16
|
end
|
|
9
17
|
|
|
10
|
-
def self.
|
|
18
|
+
def self.get_username
|
|
11
19
|
return @username
|
|
12
20
|
end
|
|
13
21
|
|
|
14
|
-
def self.
|
|
15
|
-
@
|
|
22
|
+
def self.set_paymentGateway(paymentG)
|
|
23
|
+
@paymentGateway = paymentG
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.set_locale(locale)
|
|
27
|
+
@locale= locale
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.set_param_supportedTypes(supportedTypes)
|
|
31
|
+
@param_supportedTypes = supportedTypes
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.set_endpoint(url)
|
|
35
|
+
if((url == 'https://rest.zuora.com/v1/rsa-signatures') || (url == 'https://rest.eu.zuora.com/v1/rsa-signatures') || (url == 'https://rest.apisandbox.zuora.com/v1/rsa-signatures') || (url=='https://rest.sandbox.eu.zuora.com/v1/rsa-signatures'))
|
|
36
|
+
@url = url
|
|
37
|
+
else
|
|
38
|
+
puts 'Invalid z_environment. Go to https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/LA_Hosted_Payment_Pages/B_Payment_Pages_2.0/F_Generate_the_Digital_Signature_for_Payment_Pages_2.0 to see valid urls.'
|
|
39
|
+
@url = 'invalid'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.get_endpoint
|
|
44
|
+
return @url
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.get_uri
|
|
48
|
+
if((@url == 'https://rest.zuora.com/v1/rsa-signatures') || (@url == 'https://rest.eu.zuora.com/v1/rsa-signatures'))
|
|
49
|
+
@uri = 'https://www.zuora.com/apps/PublicHostedPageLite.do'
|
|
50
|
+
elsif((@url == 'https://rest.apisandbox.zuora.com/v1/rsa-signatures') || (@url=='https://rest.sandbox.eu.zuora.com/v1/rsa-signatures'))
|
|
51
|
+
@uri = 'https://apisandbox.zuora.com/apps/PublicHostedPageLite.do'
|
|
52
|
+
else
|
|
53
|
+
@uri = 'invalid'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.set_style=(style)
|
|
58
|
+
if(style == 'inline_in')
|
|
59
|
+
@style = "inline"
|
|
60
|
+
@submitEnabled = true
|
|
61
|
+
elsif(style == 'inline_out')
|
|
62
|
+
@style = "inline"
|
|
63
|
+
@submitEnabled = false
|
|
64
|
+
elsif(style == 'overlay')
|
|
65
|
+
@style = "overlay"
|
|
66
|
+
@submitEnabled = true
|
|
67
|
+
else
|
|
68
|
+
@style = 'invalid'
|
|
69
|
+
end
|
|
16
70
|
end
|
|
17
71
|
|
|
18
|
-
def self.
|
|
19
|
-
return @
|
|
72
|
+
def self.get_style
|
|
73
|
+
return @style
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.set_password=(password)
|
|
77
|
+
@password = password
|
|
20
78
|
end
|
|
21
79
|
|
|
80
|
+
|
|
22
81
|
def self.get_rsa_signature(page_id)
|
|
23
82
|
require 'uri'
|
|
24
83
|
require 'net/http'
|
|
25
84
|
require 'json'
|
|
26
85
|
@page_id = page_id
|
|
27
|
-
url = URI(
|
|
28
|
-
the_request_url =
|
|
86
|
+
url = URI(@url)
|
|
87
|
+
the_request_url = @uri
|
|
29
88
|
http = Net::HTTP.new(url.host, url.port)
|
|
30
89
|
http.use_ssl = true
|
|
31
90
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
@@ -37,11 +96,11 @@ module ZuoraHpm
|
|
|
37
96
|
|
|
38
97
|
response = http.request(request)
|
|
39
98
|
@data = JSON.parse(response.body)
|
|
40
|
-
|
|
99
|
+
set_data
|
|
41
100
|
return @data
|
|
42
101
|
end
|
|
43
102
|
|
|
44
|
-
def self.
|
|
103
|
+
def self.set_data
|
|
45
104
|
@signature = @data["signature"]
|
|
46
105
|
@token = @data["token"]
|
|
47
106
|
@tenant_id = @data["tenantId"]
|
|
@@ -49,77 +108,41 @@ module ZuoraHpm
|
|
|
49
108
|
@success = @data["success"]
|
|
50
109
|
end
|
|
51
110
|
|
|
52
|
-
def self.
|
|
53
|
-
return @page_id
|
|
54
|
-
end
|
|
55
|
-
def self.signature
|
|
111
|
+
def self.get_signature
|
|
56
112
|
return @signature
|
|
57
113
|
end
|
|
58
114
|
|
|
59
|
-
def self.
|
|
115
|
+
def self.get_token
|
|
60
116
|
return @token
|
|
61
117
|
end
|
|
62
118
|
|
|
63
|
-
def self.
|
|
119
|
+
def self.get_tenant_id
|
|
64
120
|
return @tenant_id
|
|
65
121
|
end
|
|
66
122
|
|
|
67
|
-
def self.
|
|
123
|
+
def self.get_key
|
|
68
124
|
return @key
|
|
69
125
|
end
|
|
70
126
|
|
|
71
|
-
def self.
|
|
127
|
+
def self.get_success
|
|
72
128
|
return @success
|
|
73
129
|
end
|
|
74
130
|
|
|
75
|
-
def self.
|
|
131
|
+
def self.get_params(style)
|
|
76
132
|
require 'json'
|
|
77
|
-
if style = 'inline_in'
|
|
78
133
|
@params = {
|
|
79
134
|
tenantId: "#{@tenant_id}",
|
|
80
135
|
id: "#{@page_id}",
|
|
81
136
|
token: "#{@token}",
|
|
82
137
|
signature: "#{@signature}",
|
|
83
|
-
style: "
|
|
138
|
+
style: "#{@style}",
|
|
84
139
|
key: "#{@key}",
|
|
85
|
-
submitEnabled: "
|
|
86
|
-
locale: "
|
|
87
|
-
param_supportedTypes: "
|
|
88
|
-
url: "
|
|
89
|
-
paymentGateway: "
|
|
140
|
+
submitEnabled: "#{@submitEnabled}",
|
|
141
|
+
locale: "#{@locale}",
|
|
142
|
+
param_supportedTypes: "#{@param_supportedTypes}",
|
|
143
|
+
url: "#{@uri}",
|
|
144
|
+
paymentGateway: "#{@paymentGateway}"
|
|
90
145
|
}
|
|
91
|
-
elsif style = 'inline_out'
|
|
92
|
-
@params = {
|
|
93
|
-
tenantId: "#{@tenant_id}",
|
|
94
|
-
id: "#{@page_id}",
|
|
95
|
-
token: "#{@token}",
|
|
96
|
-
signature: "#{@signature}",
|
|
97
|
-
style: "inline",
|
|
98
|
-
key: "#{@key}",
|
|
99
|
-
submitEnabled: "false",
|
|
100
|
-
locale: "en",
|
|
101
|
-
param_supportedTypes: "AmericanExpress,JCB,Visa,MasterCard,Discover,Dankort",
|
|
102
|
-
url: "https://apisandbox.zuora.com/apps/PublicHostedPageLite.do",
|
|
103
|
-
paymentGateway: "Test"
|
|
104
|
-
}
|
|
105
|
-
elsif style = 'overlay'
|
|
106
|
-
@params = {
|
|
107
|
-
tenantId: "#{@tenant_id}",
|
|
108
|
-
id: "#{@page_id}",
|
|
109
|
-
token: "#{@token}",
|
|
110
|
-
signature: "#{@signature}",
|
|
111
|
-
style: "overlay",
|
|
112
|
-
key: "#{@key}",
|
|
113
|
-
submitEnabled: "true",
|
|
114
|
-
locale: "en",
|
|
115
|
-
param_supportedTypes: "AmericanExpress,JCB,Visa,MasterCard,Discover,Dankort",
|
|
116
|
-
url: "https://apisandbox.zuora.com/apps/PublicHostedPageLite.do",
|
|
117
|
-
paymentGateway: "Test"
|
|
118
|
-
}
|
|
119
|
-
else
|
|
120
|
-
#ERROR!!
|
|
121
|
-
|
|
122
|
-
end
|
|
123
146
|
return @params
|
|
124
147
|
end
|
|
125
148
|
|
data/lib/ZuoraHpm/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ZuoraHpm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Erica Vano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-07-
|
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|