cpay 0.1.0 → 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/.idea/workspace.xml +167 -30
- data/lib/cpay.rb +220 -134
- data/lib/cpay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 443e256c8b4a184c9e1703034012556f6c90ce304efb5086a7f41b455b600732
|
|
4
|
+
data.tar.gz: 839baed22a08fc7dfc64527fcc714b588fe4f8f50cdfd0ff11815c185d4ae515
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eeb29f7e93b34dcbf393f14f9bdec3dbf8fe99f4562f0ee4f5f2298c8af62a2a3a552df415592b85d2c5138ba067643e03445e02e054388f7c55b81bf7bfcfb1
|
|
7
|
+
data.tar.gz: 5aafd9f161d9d78ec0c4284f9f5f80a19bbf795fbae1813dca163150a97df9e1d84cecee83ab9bf05b32ba3f8fee19b078f3452f81b93ad8f7577ba81784f754
|
data/.idea/workspace.xml
CHANGED
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
29
29
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
30
30
|
</component>
|
|
31
|
+
<component name="CoverageDataManager">
|
|
32
|
+
<SUITE FILE_PATH="coverage/cpay@test_it_does_something_useful__cpay.rcov" NAME="test_it_does_something_useful: cpay Coverage Results" MODIFIED="1540553859030" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="cpay" />
|
|
33
|
+
</component>
|
|
31
34
|
<component name="FUSProjectUsageTrigger">
|
|
32
35
|
<session id="1975939896">
|
|
33
36
|
<usages-collector id="statistics.lifecycle.project">
|
|
@@ -40,53 +43,74 @@
|
|
|
40
43
|
<counts>
|
|
41
44
|
<entry key="gemspec" value="1" />
|
|
42
45
|
<entry key="md" value="1" />
|
|
43
|
-
<entry key="rb" value="
|
|
46
|
+
<entry key="rb" value="8" />
|
|
44
47
|
</counts>
|
|
45
48
|
</usages-collector>
|
|
46
49
|
<usages-collector id="statistics.file.types.open">
|
|
47
50
|
<counts>
|
|
48
51
|
<entry key="Markdown" value="1" />
|
|
49
|
-
<entry key="Ruby" value="
|
|
52
|
+
<entry key="Ruby" value="9" />
|
|
50
53
|
</counts>
|
|
51
54
|
</usages-collector>
|
|
52
55
|
<usages-collector id="statistics.file.extensions.edit">
|
|
53
56
|
<counts>
|
|
54
57
|
<entry key="gemspec" value="75" />
|
|
58
|
+
<entry key="rb" value="2019" />
|
|
55
59
|
</counts>
|
|
56
60
|
</usages-collector>
|
|
57
61
|
<usages-collector id="statistics.file.types.edit">
|
|
58
62
|
<counts>
|
|
59
|
-
<entry key="Ruby" value="
|
|
63
|
+
<entry key="Ruby" value="2094" />
|
|
60
64
|
</counts>
|
|
61
65
|
</usages-collector>
|
|
66
|
+
<usages-collector id="statistics.js.language.service.starts" />
|
|
67
|
+
<usages-collector id="statistics.actions.runAnything" />
|
|
68
|
+
<usages-collector id="statistics.vcs.git.usages" />
|
|
62
69
|
</session>
|
|
63
70
|
</component>
|
|
64
71
|
<component name="FileEditorManager">
|
|
65
72
|
<leaf>
|
|
66
73
|
<file pinned="false" current-in-tab="false">
|
|
67
|
-
<entry file="file://$
|
|
74
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.5.1/lib/ruby/2.5.0/cgi/core.rb">
|
|
68
75
|
<provider selected="true" editor-type-id="text-editor">
|
|
69
|
-
<state relative-caret-position="
|
|
70
|
-
<caret line="
|
|
76
|
+
<state relative-caret-position="-165">
|
|
77
|
+
<caret line="383" selection-start-line="383" selection-end-line="383" />
|
|
71
78
|
</state>
|
|
72
79
|
</provider>
|
|
73
80
|
</entry>
|
|
74
81
|
</file>
|
|
75
82
|
<file pinned="false" current-in-tab="false">
|
|
76
|
-
<entry file="file://$PROJECT_DIR$/
|
|
77
|
-
<provider selected="true" editor-type-id="
|
|
78
|
-
<state
|
|
79
|
-
<
|
|
80
|
-
<second_editor />
|
|
83
|
+
<entry file="file://$PROJECT_DIR$/test/cpay_test.rb">
|
|
84
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
85
|
+
<state relative-caret-position="1617">
|
|
86
|
+
<caret line="77" column="32" selection-start-line="77" selection-start-column="32" selection-end-line="77" selection-end-column="32" />
|
|
81
87
|
</state>
|
|
82
88
|
</provider>
|
|
83
89
|
</entry>
|
|
84
90
|
</file>
|
|
85
|
-
<file pinned="false" current-in-tab="
|
|
91
|
+
<file pinned="false" current-in-tab="false">
|
|
92
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.5.1/lib/ruby/2.5.0/json/common.rb">
|
|
93
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
94
|
+
<state relative-caret-position="196">
|
|
95
|
+
<caret line="223" selection-start-line="223" selection-end-line="223" />
|
|
96
|
+
</state>
|
|
97
|
+
</provider>
|
|
98
|
+
</entry>
|
|
99
|
+
</file>
|
|
100
|
+
<file pinned="false" current-in-tab="false">
|
|
86
101
|
<entry file="file://$PROJECT_DIR$/cpay.gemspec">
|
|
87
102
|
<provider selected="true" editor-type-id="text-editor">
|
|
88
|
-
<state relative-caret-position="
|
|
89
|
-
<caret line="
|
|
103
|
+
<state relative-caret-position="179">
|
|
104
|
+
<caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
|
|
105
|
+
</state>
|
|
106
|
+
</provider>
|
|
107
|
+
</entry>
|
|
108
|
+
</file>
|
|
109
|
+
<file pinned="false" current-in-tab="true">
|
|
110
|
+
<entry file="file://$PROJECT_DIR$/lib/cpay/version.rb">
|
|
111
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
112
|
+
<state relative-caret-position="21">
|
|
113
|
+
<caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
|
|
90
114
|
</state>
|
|
91
115
|
</provider>
|
|
92
116
|
</entry>
|
|
@@ -96,8 +120,11 @@
|
|
|
96
120
|
<component name="FindInProjectRecents">
|
|
97
121
|
<findStrings>
|
|
98
122
|
<find>homepage_uri</find>
|
|
99
|
-
<find>FIXME</find>
|
|
100
123
|
<find>TODO</find>
|
|
124
|
+
<find>queryOrder</find>
|
|
125
|
+
<find>FIXME</find>
|
|
126
|
+
<find>url_decode</find>
|
|
127
|
+
<find>gsub</find>
|
|
101
128
|
</findStrings>
|
|
102
129
|
</component>
|
|
103
130
|
<component name="Git.Settings">
|
|
@@ -106,8 +133,10 @@
|
|
|
106
133
|
<component name="IdeDocumentHistory">
|
|
107
134
|
<option name="CHANGED_PATHS">
|
|
108
135
|
<list>
|
|
109
|
-
<option value="$PROJECT_DIR$/lib/cpay.rb" />
|
|
110
136
|
<option value="$PROJECT_DIR$/cpay.gemspec" />
|
|
137
|
+
<option value="$PROJECT_DIR$/lib/cpay.rb" />
|
|
138
|
+
<option value="$PROJECT_DIR$/test/cpay_test.rb" />
|
|
139
|
+
<option value="$PROJECT_DIR$/lib/cpay/version.rb" />
|
|
111
140
|
</list>
|
|
112
141
|
</option>
|
|
113
142
|
</component>
|
|
@@ -145,6 +174,11 @@
|
|
|
145
174
|
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
146
175
|
<item name="cpay" type="462c0819:PsiDirectoryNode" />
|
|
147
176
|
</path>
|
|
177
|
+
<path>
|
|
178
|
+
<item name="cpay" type="b2602c69:ProjectViewProjectNode" />
|
|
179
|
+
<item name="cpay" type="462c0819:PsiDirectoryNode" />
|
|
180
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
|
181
|
+
</path>
|
|
148
182
|
</expand>
|
|
149
183
|
<select />
|
|
150
184
|
</subPane>
|
|
@@ -169,6 +203,42 @@
|
|
|
169
203
|
</list>
|
|
170
204
|
</option>
|
|
171
205
|
</component>
|
|
206
|
+
<component name="RunManager">
|
|
207
|
+
<configuration name="test_it_does_something_useful: cpay" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest" temporary="true">
|
|
208
|
+
<predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
|
|
209
|
+
<module name="cpay" />
|
|
210
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-Ilib:test" />
|
|
211
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
212
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
213
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
214
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
215
|
+
<envs>
|
|
216
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
|
217
|
+
</envs>
|
|
218
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
219
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
220
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
|
|
221
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
222
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
223
|
+
</COVERAGE_PATTERN>
|
|
224
|
+
</EXTENSION>
|
|
225
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
226
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/test/cpay_test.rb" />
|
|
227
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
|
228
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="test_it_does_something_useful" />
|
|
229
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_METHOD" />
|
|
230
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
231
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
232
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
233
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
|
234
|
+
<method v="2" />
|
|
235
|
+
</configuration>
|
|
236
|
+
<recent_temporary>
|
|
237
|
+
<list>
|
|
238
|
+
<item itemvalue="Test::Unit/Shoulda/Minitest.test_it_does_something_useful: cpay" />
|
|
239
|
+
</list>
|
|
240
|
+
</recent_temporary>
|
|
241
|
+
</component>
|
|
172
242
|
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
|
173
243
|
<component name="SvnConfiguration">
|
|
174
244
|
<configuration />
|
|
@@ -180,24 +250,56 @@
|
|
|
180
250
|
<option name="number" value="Default" />
|
|
181
251
|
<option name="presentableId" value="Default" />
|
|
182
252
|
<updated>1540542021525</updated>
|
|
183
|
-
<workItem from="1540542023212" duration="
|
|
253
|
+
<workItem from="1540542023212" duration="10096000" />
|
|
184
254
|
</task>
|
|
185
255
|
<servers />
|
|
186
256
|
</component>
|
|
257
|
+
<component name="TestHistory">
|
|
258
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 28m 58s.xml">
|
|
259
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
260
|
+
</history-entry>
|
|
261
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 29m 12s.xml">
|
|
262
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
263
|
+
</history-entry>
|
|
264
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 29m 24s.xml">
|
|
265
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
266
|
+
</history-entry>
|
|
267
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 29m 58s.xml">
|
|
268
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
269
|
+
</history-entry>
|
|
270
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 30m 12s.xml">
|
|
271
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
272
|
+
</history-entry>
|
|
273
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 32m 44s.xml">
|
|
274
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
275
|
+
</history-entry>
|
|
276
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 33m 02s.xml">
|
|
277
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
278
|
+
</history-entry>
|
|
279
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 33m 20s.xml">
|
|
280
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
281
|
+
</history-entry>
|
|
282
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 37m 16s.xml">
|
|
283
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
284
|
+
</history-entry>
|
|
285
|
+
<history-entry file="test_it_does_something_useful__cpay - 2018.10.26 at 19h 37m 39s.xml">
|
|
286
|
+
<configuration name="test_it_does_something_useful: cpay" configurationId="TestUnitRunConfigurationType" />
|
|
287
|
+
</history-entry>
|
|
288
|
+
</component>
|
|
187
289
|
<component name="TimeTrackingManager">
|
|
188
|
-
<option name="totallyTimeSpent" value="
|
|
290
|
+
<option name="totallyTimeSpent" value="10096000" />
|
|
189
291
|
</component>
|
|
190
292
|
<component name="ToolWindowManager">
|
|
191
293
|
<frame x="0" y="0" width="1680" height="1050" extended-state="0" />
|
|
192
294
|
<editor active="true" />
|
|
193
295
|
<layout>
|
|
194
296
|
<window_info id="Favorites" side_tool="true" />
|
|
195
|
-
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" />
|
|
297
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" />
|
|
196
298
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
197
299
|
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
|
198
300
|
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
|
|
199
301
|
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
|
200
|
-
<window_info
|
|
302
|
+
<window_info anchor="bottom" id="Terminal" visible="true" weight="0.32917964" />
|
|
201
303
|
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
202
304
|
<window_info anchor="bottom" id="Message" order="0" />
|
|
203
305
|
<window_info anchor="bottom" id="Find" order="1" />
|
|
@@ -219,12 +321,8 @@
|
|
|
219
321
|
<option name="myLimit" value="2678400000" />
|
|
220
322
|
</component>
|
|
221
323
|
<component name="editorHistoryManager">
|
|
222
|
-
<entry file="file://$PROJECT_DIR$/
|
|
223
|
-
<provider selected="true" editor-type-id="text-editor"
|
|
224
|
-
<state relative-caret-position="294">
|
|
225
|
-
<caret line="14" column="22" selection-start-line="14" selection-start-column="22" selection-end-line="14" selection-end-column="22" />
|
|
226
|
-
</state>
|
|
227
|
-
</provider>
|
|
324
|
+
<entry file="file://$PROJECT_DIR$/test/test_helper.rb">
|
|
325
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
228
326
|
</entry>
|
|
229
327
|
<entry file="file://$PROJECT_DIR$/CODE_OF_CONDUCT.md">
|
|
230
328
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
@@ -234,13 +332,52 @@
|
|
|
234
332
|
</state>
|
|
235
333
|
</provider>
|
|
236
334
|
</entry>
|
|
237
|
-
<entry file="file://$
|
|
238
|
-
<provider selected="true" editor-type-id="text-editor"
|
|
335
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.5.1/lib/ruby/2.5.0/json/common.rb">
|
|
336
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
337
|
+
<state relative-caret-position="196">
|
|
338
|
+
<caret line="223" selection-start-line="223" selection-end-line="223" />
|
|
339
|
+
</state>
|
|
340
|
+
</provider>
|
|
239
341
|
</entry>
|
|
240
342
|
<entry file="file://$PROJECT_DIR$/cpay.gemspec">
|
|
241
343
|
<provider selected="true" editor-type-id="text-editor">
|
|
242
|
-
<state relative-caret-position="
|
|
243
|
-
<caret line="
|
|
344
|
+
<state relative-caret-position="179">
|
|
345
|
+
<caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
|
|
346
|
+
</state>
|
|
347
|
+
</provider>
|
|
348
|
+
</entry>
|
|
349
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.5.1/lib/ruby/2.5.0/base64.rb">
|
|
350
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
351
|
+
<state relative-caret-position="203">
|
|
352
|
+
<caret line="58" selection-start-line="58" selection-end-line="58" />
|
|
353
|
+
</state>
|
|
354
|
+
</provider>
|
|
355
|
+
</entry>
|
|
356
|
+
<entry file="file://$PROJECT_DIR$/lib/cpay.rb">
|
|
357
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
358
|
+
<state relative-caret-position="298">
|
|
359
|
+
<caret line="88" column="35" lean-forward="true" selection-start-line="88" selection-start-column="35" selection-end-line="88" selection-end-column="35" />
|
|
360
|
+
</state>
|
|
361
|
+
</provider>
|
|
362
|
+
</entry>
|
|
363
|
+
<entry file="file://$USER_HOME$/.rbenv/versions/2.5.1/lib/ruby/2.5.0/cgi/core.rb">
|
|
364
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
365
|
+
<state relative-caret-position="-165">
|
|
366
|
+
<caret line="383" selection-start-line="383" selection-end-line="383" />
|
|
367
|
+
</state>
|
|
368
|
+
</provider>
|
|
369
|
+
</entry>
|
|
370
|
+
<entry file="file://$PROJECT_DIR$/test/cpay_test.rb">
|
|
371
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
372
|
+
<state relative-caret-position="1617">
|
|
373
|
+
<caret line="77" column="32" selection-start-line="77" selection-start-column="32" selection-end-line="77" selection-end-column="32" />
|
|
374
|
+
</state>
|
|
375
|
+
</provider>
|
|
376
|
+
</entry>
|
|
377
|
+
<entry file="file://$PROJECT_DIR$/lib/cpay/version.rb">
|
|
378
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
379
|
+
<state relative-caret-position="21">
|
|
380
|
+
<caret line="1" column="16" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
|
|
244
381
|
</state>
|
|
245
382
|
</provider>
|
|
246
383
|
</entry>
|
data/lib/cpay.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Cpay
|
|
|
5
5
|
require 'net/http'
|
|
6
6
|
require 'openssl'
|
|
7
7
|
require 'base64'
|
|
8
|
+
require 'cgi'
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
module Utils
|
|
@@ -55,66 +56,46 @@ module Cpay
|
|
|
55
56
|
end
|
|
56
57
|
|
|
57
58
|
module Sand
|
|
58
|
-
|
|
59
|
+
module Fastpay
|
|
60
|
+
extend self
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
=begin
|
|
62
|
-
p = {
|
|
63
|
-
mid: mid,
|
|
64
|
-
privatekey: privatekey,
|
|
65
|
-
userid: userid,
|
|
66
|
-
orderid: orderid,
|
|
67
|
-
amount: amount,
|
|
68
|
-
subject: subject,
|
|
69
|
-
body: body,
|
|
70
|
-
notifyurl: notifyurl,
|
|
71
|
-
fronturl: fronturl,
|
|
72
|
-
}
|
|
73
|
-
=end
|
|
74
|
-
begin
|
|
62
|
+
def pay(c_params)
|
|
75
63
|
time = Time.now.strftime('%Y%m%d%H%M%S')
|
|
76
|
-
|
|
77
|
-
head: {
|
|
78
|
-
version: '1.0',
|
|
79
|
-
method: 'sandPay.fastPay.quickPay.index',
|
|
80
|
-
productId: '00000016',
|
|
81
|
-
accessType: '1',
|
|
82
|
-
mid: pay_params[:mid].to_s,
|
|
83
|
-
channelType: '07',
|
|
84
|
-
reqTime: time
|
|
85
|
-
},
|
|
64
|
+
b_params = {
|
|
86
65
|
body: {
|
|
87
|
-
userId:
|
|
88
|
-
orderCode:
|
|
66
|
+
userId: c_params[:userid].to_s, #用户ID
|
|
67
|
+
orderCode: c_params[:orderid].to_s, #订单号
|
|
89
68
|
orderTime: time,
|
|
90
|
-
totalAmount:
|
|
91
|
-
subject:
|
|
92
|
-
body:
|
|
69
|
+
totalAmount: c_params[:amount].to_s.rjust(12, '0'), #订单金额
|
|
70
|
+
subject: c_params[:subject].to_s, #订单标题
|
|
71
|
+
body: c_params[:body].to_s, #订单描述
|
|
93
72
|
currencyCode: 156,
|
|
94
|
-
notifyUrl:
|
|
95
|
-
frontUrl:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
73
|
+
notifyUrl: c_params[:notifyurl].to_s, #异步通知地址
|
|
74
|
+
frontUrl: c_params[:fronturl].to_s, #前端跳转地址
|
|
75
|
+
},
|
|
76
|
+
method: "sandPay.fastPay.quickPay.index"
|
|
99
77
|
}
|
|
100
|
-
|
|
78
|
+
res = base_pay_act b_params, c_params, true
|
|
79
|
+
|
|
80
|
+
if res[:code] = 0
|
|
81
|
+
return %Q{
|
|
101
82
|
<form action="https://cashier.sandpay.com.cn/fastPay/quickPay/index" method="post" hidden="hidden">
|
|
102
|
-
<textarea name="charset"
|
|
103
|
-
<textarea name="signType"
|
|
104
|
-
<textarea name="data">#{data
|
|
105
|
-
<textarea name="sign">#{
|
|
83
|
+
<textarea name="charset">#{res[:data][:charset]}</textarea>
|
|
84
|
+
<textarea name="signType">#{res[:data][:signType]}</textarea>
|
|
85
|
+
<textarea name="data">#{res[:data][:data]}</textarea>
|
|
86
|
+
<textarea name="sign">#{res[:data][:sign]}</textarea>
|
|
106
87
|
</form>
|
|
107
88
|
<script type="text/javascript">
|
|
108
89
|
document.forms[0].submit();
|
|
109
90
|
</script>
|
|
110
91
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
92
|
+
else
|
|
93
|
+
return "生成订单失败,请稍后重试"
|
|
94
|
+
end
|
|
95
|
+
|
|
114
96
|
end
|
|
115
|
-
end
|
|
116
97
|
|
|
117
|
-
|
|
98
|
+
def quickly_notify?(sign, data, publickey)
|
|
118
99
|
=begin
|
|
119
100
|
return {
|
|
120
101
|
orderid:'12311',
|
|
@@ -124,109 +105,214 @@ return {
|
|
|
124
105
|
state: '1',
|
|
125
106
|
}
|
|
126
107
|
=end
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
108
|
+
m_res = {
|
|
109
|
+
orderid: '0',
|
|
110
|
+
amount: '0',
|
|
111
|
+
transid: '0',
|
|
112
|
+
successcode: 'success',
|
|
113
|
+
state: -1,
|
|
114
|
+
msg: '',
|
|
115
|
+
}
|
|
116
|
+
begin
|
|
117
|
+
if Utils.rsa_verify(data, sign, publickey)
|
|
118
|
+
data = JSON data
|
|
119
|
+
head = data['head']
|
|
120
|
+
body = data['body']
|
|
121
|
+
if head['respCode'] != '000000' || head['orderStatus'] != '1'
|
|
122
|
+
m_res[:state] = 1
|
|
123
|
+
else
|
|
124
|
+
m_res[:orderid] = body["orderCode"]
|
|
125
|
+
m_res[:transid] = body["tradeNo"]
|
|
126
|
+
m_res[:amount] = body["totalAmount"]
|
|
127
|
+
m_res[:state] = 0
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
rescue Exception => ex
|
|
131
|
+
m_res[:msg] = ex.to_s
|
|
132
|
+
end
|
|
133
|
+
m_res
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def orderQuery(c_params)
|
|
137
|
+
b_params = {
|
|
138
|
+
body: {
|
|
139
|
+
orderCode: c_params[:orderid].to_s, #订单号
|
|
140
|
+
},
|
|
141
|
+
method: "sandpay.trade.query",
|
|
142
|
+
uri: URI("https://cashier.sandpay.com.cn/gateway/api/order/query")
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
base_pay_act b_params, c_params, false
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
private
|
|
149
|
+
|
|
150
|
+
def base_pay_act(b_params, c_params, return_req_data)
|
|
151
|
+
ret = {
|
|
152
|
+
code: -1,
|
|
153
|
+
msg: '',
|
|
154
|
+
data: {}
|
|
155
|
+
}
|
|
156
|
+
begin
|
|
157
|
+
time = Time.now.strftime('%Y%m%d%H%M%S')
|
|
158
|
+
data = {
|
|
159
|
+
head: {
|
|
160
|
+
version: '1.0',
|
|
161
|
+
method: b_params[:method],
|
|
162
|
+
productId: '00000016',
|
|
163
|
+
accessType: '1',
|
|
164
|
+
mid: c_params[:mid].to_s,
|
|
165
|
+
channelType: '07',
|
|
166
|
+
reqTime: time
|
|
167
|
+
},
|
|
168
|
+
body: b_params[:body]
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
req_data = {
|
|
172
|
+
charset: 'utf-8',
|
|
173
|
+
signType: '01',
|
|
174
|
+
data: data.to_json,
|
|
175
|
+
sign: Utils.rsa_sign(data.to_json, c_params[:privatekey])
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if return_req_data
|
|
179
|
+
ret[:code] = 0
|
|
180
|
+
ret[:data] = req_data
|
|
142
181
|
else
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
182
|
+
res = Net::HTTP.post_form b_params[:uri], req_data
|
|
183
|
+
|
|
184
|
+
puts res.body
|
|
185
|
+
cgi_parse = CGI.parse(Utils.url_decode(res.body))
|
|
186
|
+
unless Utils.rsa_verify(cgi_parse['data'][0], cgi_parse['sign'][0].to_s.gsub(' ', '+'), c_params[:publickey])
|
|
187
|
+
ret[:code] = 2
|
|
188
|
+
else
|
|
189
|
+
ret[:code] = 0
|
|
190
|
+
ret[:data] = JSON(cgi_parse['data'][0])['head']
|
|
191
|
+
end
|
|
147
192
|
end
|
|
193
|
+
rescue Exception => ex
|
|
194
|
+
ret[:msg] = ex.to_s
|
|
195
|
+
ret[:code] = -1
|
|
148
196
|
end
|
|
149
|
-
|
|
150
|
-
|
|
197
|
+
ret
|
|
198
|
+
|
|
199
|
+
|
|
151
200
|
end
|
|
152
|
-
|
|
201
|
+
|
|
153
202
|
end
|
|
154
203
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
draw_params = {
|
|
158
|
-
orderid: '123', #订单号
|
|
159
|
-
amount: '123', #金额
|
|
160
|
-
accno: '123', #银行卡账号
|
|
161
|
-
accname: '123', #姓名
|
|
162
|
-
remark: '123', #备注
|
|
163
|
-
mid: '123', #杉徳id
|
|
164
|
-
publickey: '123', #杉徳公钥
|
|
165
|
-
privatekey: '123', #杉徳私钥
|
|
166
|
-
}
|
|
204
|
+
module Draw
|
|
205
|
+
extend self
|
|
167
206
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
207
|
+
def agentpay(c_params)
|
|
208
|
+
b_params = {
|
|
209
|
+
uri: URI("https://caspay.sandpay.com.cn/agent-main/openapi/agentpay"),
|
|
210
|
+
pt: {
|
|
211
|
+
orderCode: c_params[:orderid].to_s,
|
|
212
|
+
version: '01',
|
|
213
|
+
productId: '00000004',
|
|
214
|
+
tranTime: Time.now.strftime('%Y%m%d%H%M%S'),
|
|
215
|
+
tranAmt: c_params[:amount].to_s.rjust(12, '0'),
|
|
216
|
+
currencyCode: '156',
|
|
217
|
+
accAttr: '0',
|
|
218
|
+
accType: '4',
|
|
219
|
+
accNo: c_params[:accno],
|
|
220
|
+
accName: c_params[:accname],
|
|
221
|
+
remark: c_params[:remark],
|
|
222
|
+
},
|
|
223
|
+
transCode: 'RTPM',
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
base_draw_act b_params, c_params
|
|
181
227
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
228
|
+
|
|
229
|
+
# if sand_res[:sign?]
|
|
230
|
+
# sand_res_data = sand_res[:data]
|
|
231
|
+
# res[:state] = sand_res_data['resultFlag']
|
|
232
|
+
# res[:msg] = sand_res_data['respDesc']
|
|
233
|
+
# else
|
|
234
|
+
# res[:state] = 2
|
|
235
|
+
# end
|
|
236
|
+
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def queryBalance(c_params)
|
|
240
|
+
|
|
241
|
+
b_params = {
|
|
242
|
+
uri: URI("https://caspay.sandpay.com.cn/agent-main/openapi/queryBalance"),
|
|
243
|
+
pt: {
|
|
244
|
+
orderCode: c_params[:orderid].to_s,
|
|
245
|
+
version: '01',
|
|
246
|
+
productId: '00000004',
|
|
247
|
+
tranTime: Time.now.strftime('%Y%m%d%H%M%S'),
|
|
248
|
+
},
|
|
249
|
+
transCode: 'MBQU',
|
|
199
250
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
251
|
+
|
|
252
|
+
base_draw_act b_params, c_params
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def queryOrder c_params
|
|
256
|
+
b_params = {
|
|
257
|
+
uri: URI("https://caspay.sandpay.com.cn/agent-main/openapi/queryOrder"),
|
|
258
|
+
pt: {
|
|
259
|
+
orderCode: c_params[:orderid].to_s,
|
|
260
|
+
version: '01',
|
|
261
|
+
productId: '00000004',
|
|
262
|
+
tranTime: Time.now.strftime('%Y%m%d%H%M%S'),
|
|
263
|
+
},
|
|
264
|
+
transCode: 'ODQU',
|
|
207
265
|
}
|
|
208
|
-
res = Net::HTTP.post_form uri, data
|
|
209
|
-
res_param = {}
|
|
210
|
-
Utils.url_decode(res.body).split('&').each do |str|
|
|
211
|
-
str_split = str.split('=')
|
|
212
|
-
res_param[str_split[0]] = str_split[1]
|
|
213
|
-
end
|
|
214
266
|
|
|
215
|
-
|
|
267
|
+
base_draw_act b_params, c_params
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
private
|
|
271
|
+
|
|
272
|
+
def base_draw_act(b_params, c_params)
|
|
216
273
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
274
|
+
ret = {
|
|
275
|
+
code: -1,
|
|
276
|
+
msg: '',
|
|
277
|
+
data: {}
|
|
278
|
+
}
|
|
279
|
+
begin
|
|
280
|
+
|
|
281
|
+
uri = b_params[:uri]
|
|
282
|
+
pt = b_params[:pt]
|
|
283
|
+
aes_key = rand(36 ** 16).to_s(36)
|
|
284
|
+
data = {
|
|
285
|
+
transCode: b_params[:transCode],
|
|
286
|
+
accessType: '0',
|
|
287
|
+
merId: c_params[:mid],
|
|
288
|
+
encryptKey: Utils.rsa_encrypt_by_pub(aes_key, c_params[:publickey]),
|
|
289
|
+
encryptData: Utils.aes_encrypt(pt.to_json, aes_key),
|
|
290
|
+
sign: Utils.rsa_sign(pt.to_json, c_params[:privatekey]),
|
|
291
|
+
}
|
|
292
|
+
res = Net::HTTP.post_form uri, data
|
|
293
|
+
res_param = {}
|
|
294
|
+
body = res.body
|
|
295
|
+
body[0] = ''
|
|
296
|
+
body[-1] = ''
|
|
297
|
+
Utils.url_decode(body).split('&').each do |str|
|
|
298
|
+
str_split = str.split('=')
|
|
299
|
+
res_param[str_split[0]] = str_split[1]
|
|
300
|
+
end
|
|
301
|
+
res_data = Utils.aes_decrypt(res_param['encryptData'], Utils.rsa_decrypt_by_pri(res_param['encryptKey'], c_params[:privatekey]))
|
|
302
|
+
|
|
303
|
+
if Utils.rsa_verify(res_data, res_param['sign'], c_params[:publickey])
|
|
304
|
+
ret[:code] = 0
|
|
305
|
+
ret[:data] = JSON(res_data)
|
|
306
|
+
else
|
|
307
|
+
ret[:code] = 2
|
|
308
|
+
end
|
|
309
|
+
rescue Exception => ex
|
|
310
|
+
ret[:msg] = ex.to_s
|
|
311
|
+
ret[:code] = -1
|
|
223
312
|
end
|
|
224
|
-
|
|
225
|
-
m_res[:msg] = ex.to_s
|
|
313
|
+
ret
|
|
226
314
|
end
|
|
227
|
-
m_res
|
|
228
315
|
end
|
|
229
|
-
|
|
230
316
|
end
|
|
231
317
|
|
|
232
318
|
|
data/lib/cpay/version.rb
CHANGED