tin_alipay 2.4.1 → 2.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10e571859854545cafe6618f2518a3bea7f19224
4
- data.tar.gz: 8c20f17b0bae5c016631fd1ee0687c3c40e2dda1
3
+ metadata.gz: 3f94842e61d2450e2cafabf6f4fddfa30bdd7ca0
4
+ data.tar.gz: e88c92599caeec18fedaf59122f2460d78eee968
5
5
  SHA512:
6
- metadata.gz: 441e1ca99b5b4b6ac2daa3c91cb179c823a2845c76c5803c5016c9a361911565c7c10112486de7aa3fa306b1f04603fdc3740dd5e32e58b7413f06ef553c13be
7
- data.tar.gz: 62e6abf6df231a296b8599ddd981f94d95e6961811b44d910b91d6c9364fa6516b24982eaf546165043c3e0db57516f2102653b3325764e38539825d2ba5d86b
6
+ metadata.gz: 8595ee93a1bac6d5e0d4c2609e65b3923b6ab3f74cd0853c37e997499e5093f369b4cee277a4cc2906d29de37b278c7565ee53be2a56fbbd1534ac34ad5d91e9
7
+ data.tar.gz: ce06dc40ce723e50272ba5fb8263b52e3c1ba2d28df8c65d3753e8ef951c20cfaf6fc5ec4a77cb89fb41353cfa49c9f9206f7616ac7aa74a0a4046749fd12f7b
@@ -2,26 +2,28 @@ require 'open-uri'
2
2
  module TinAlipay
3
3
  module Payment
4
4
  GATEWAY_PC_URL = 'https://mapi.alipay.com/gateway.do'
5
- OPTIONS_PC_KEYS = %w( service partner _input_charset out_trade_no subject payment_type logistics_type logistics_fee logistics_payment seller_email price quantity )
5
+ OPTIONS_PC_KEYS = %w( service partner _input_charset out_trade_no subject payment_type seller_email )
6
6
  GATEWAY_MOBILE_URL = 'https://wappaygw.alipay.com/service/rest.htm'
7
7
  OPTIONS_MOBILE_KEYS = %w( subject out_trade_no total_fee seller_account_name call_back_url )
8
8
  REQUIRED_MOBILE_KEYS = %w( service format v partner req_id req_data )
9
9
  EXECUTE_MOBILE_KEYS = %w( service format v partner )
10
+ CREATE_DIRECT_PAY_BY_USER_REQUIRED_OPTIONS =
10
11
 
11
12
  def self.create_direct_pay_pc_url(options = {})
12
- options = {
13
- 'service' => 'trade_create_by_buyer',
13
+ options = {
14
+ 'service' => 'create_direct_pay_by_user',
14
15
  '_input_charset' => 'utf-8',
15
16
  'partner' => TinAlipay.pid,
16
17
  'seller_email' => TinAlipay.seller_email,
17
- 'payment_type' => '1',
18
- 'logistics_type' => 'DIRECT',
19
- 'logistics_fee' => '0',
20
- 'logistics_payment' => 'SELLER_PAY',
21
- 'quantity' => 1,
22
- 'discount' => '0'
18
+ 'payment_type' => '1'
23
19
  }.merge(new_hash(options))
20
+
24
21
  check_options_keys(options, OPTIONS_PC_KEYS)
22
+
23
+ if options['total_fee'].nil? and (options['price'].nil? || options['quantity'].nil?)
24
+ warn("Ailpay Warn: total_fee or (price && quantiry) must have one")
25
+ end
26
+
25
27
  "#{GATEWAY_PC_URL}?#{params_pc_str(options)}"
26
28
  end
27
29
 
@@ -1,3 +1,3 @@
1
1
  module TinAlipay
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
@@ -5228,3 +5228,133 @@ TinAlipay::NotifyTest: test_verify_notify_pc_when_unsign
5228
5228
  TinAlipayTest: test_truth
5229
5229
  -------------------------
5230
5230
   (0.0ms) rollback transaction
5231
+  (0.1ms) begin transaction
5232
+ -----------------------------------------
5233
+ TinAlipay::SignTest: test_excute_md5_sign
5234
+ -----------------------------------------
5235
+  (0.1ms) rollback transaction
5236
+  (0.1ms) begin transaction
5237
+ -------------------------------------
5238
+ TinAlipay::SignTest: test_verify_sign
5239
+ -------------------------------------
5240
+  (0.1ms) rollback transaction
5241
+  (0.1ms) begin transaction
5242
+ --------------------------------------------
5243
+ TinAlipay::SignTest: test_verify_sign_mobile
5244
+ --------------------------------------------
5245
+  (0.0ms) rollback transaction
5246
+  (0.1ms) begin transaction
5247
+ ------------------------------------------------
5248
+ TinAlipay::SignTest: test_verify_sign_when_fails
5249
+ ------------------------------------------------
5250
+  (0.1ms) rollback transaction
5251
+  (0.1ms) begin transaction
5252
+ -----------------------------------------------------------
5253
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_false
5254
+ -----------------------------------------------------------
5255
+  (0.1ms) rollback transaction
5256
+  (0.0ms) begin transaction
5257
+ ----------------------------------------------------------
5258
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_true
5259
+ ----------------------------------------------------------
5260
+  (0.1ms) rollback transaction
5261
+  (0.1ms) begin transaction
5262
+ ------------------------------------------------------------
5263
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_unsign
5264
+ ------------------------------------------------------------
5265
+  (0.0ms) rollback transaction
5266
+  (0.0ms) begin transaction
5267
+ -------------------------------------------------------
5268
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_false
5269
+ -------------------------------------------------------
5270
+  (0.1ms) rollback transaction
5271
+  (0.1ms) begin transaction
5272
+ ------------------------------------------------------
5273
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_true
5274
+ ------------------------------------------------------
5275
+  (0.1ms) rollback transaction
5276
+  (0.1ms) begin transaction
5277
+ --------------------------------------------------------
5278
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_unsign
5279
+ --------------------------------------------------------
5280
+  (0.1ms) rollback transaction
5281
+  (0.1ms) begin transaction
5282
+ -------------------------
5283
+ TinAlipayTest: test_truth
5284
+ -------------------------
5285
+  (0.1ms) rollback transaction
5286
+  (0.1ms) begin transaction
5287
+ ---------------------------------------------------------
5288
+ TinAlipay::PaymentTest: test_create_direct_pay_mobile_url
5289
+ ---------------------------------------------------------
5290
+  (0.1ms) rollback transaction
5291
+  (0.0ms) begin transaction
5292
+ -----------------------------------------------------
5293
+ TinAlipay::PaymentTest: test_create_direct_pay_pc_url
5294
+ -----------------------------------------------------
5295
+  (0.0ms) rollback transaction
5296
+  (0.1ms) begin transaction
5297
+ -----------------------------------------
5298
+ TinAlipay::SignTest: test_excute_md5_sign
5299
+ -----------------------------------------
5300
+  (0.0ms) rollback transaction
5301
+  (0.1ms) begin transaction
5302
+ -------------------------------------
5303
+ TinAlipay::SignTest: test_verify_sign
5304
+ -------------------------------------
5305
+  (0.0ms) rollback transaction
5306
+  (0.1ms) begin transaction
5307
+ --------------------------------------------
5308
+ TinAlipay::SignTest: test_verify_sign_mobile
5309
+ --------------------------------------------
5310
+  (0.1ms) rollback transaction
5311
+  (0.1ms) begin transaction
5312
+ ------------------------------------------------
5313
+ TinAlipay::SignTest: test_verify_sign_when_fails
5314
+ ------------------------------------------------
5315
+  (0.1ms) rollback transaction
5316
+  (0.1ms) begin transaction
5317
+ -------------------------
5318
+ TinAlipayTest: test_truth
5319
+ -------------------------
5320
+  (0.1ms) rollback transaction
5321
+  (0.1ms) begin transaction
5322
+ ---------------------------------------------------------
5323
+ TinAlipay::PaymentTest: test_create_direct_pay_mobile_url
5324
+ ---------------------------------------------------------
5325
+  (0.1ms) rollback transaction
5326
+  (0.1ms) begin transaction
5327
+ -----------------------------------------------------
5328
+ TinAlipay::PaymentTest: test_create_direct_pay_pc_url
5329
+ -----------------------------------------------------
5330
+  (0.0ms) rollback transaction
5331
+  (0.1ms) begin transaction
5332
+ -----------------------------------------------------------
5333
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_false
5334
+ -----------------------------------------------------------
5335
+  (0.1ms) rollback transaction
5336
+  (0.1ms) begin transaction
5337
+ ----------------------------------------------------------
5338
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_true
5339
+ ----------------------------------------------------------
5340
+  (0.1ms) rollback transaction
5341
+  (0.1ms) begin transaction
5342
+ ------------------------------------------------------------
5343
+ TinAlipay::NotifyTest: test_verify_notify_mobile_when_unsign
5344
+ ------------------------------------------------------------
5345
+  (0.1ms) rollback transaction
5346
+  (0.1ms) begin transaction
5347
+ -------------------------------------------------------
5348
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_false
5349
+ -------------------------------------------------------
5350
+  (0.1ms) rollback transaction
5351
+  (0.1ms) begin transaction
5352
+ ------------------------------------------------------
5353
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_true
5354
+ ------------------------------------------------------
5355
+  (0.1ms) rollback transaction
5356
+  (0.0ms) begin transaction
5357
+ --------------------------------------------------------
5358
+ TinAlipay::NotifyTest: test_verify_notify_pc_when_unsign
5359
+ --------------------------------------------------------
5360
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tin_alipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tin