activemerchant_patch_for_china 0.1.0 → 0.1.1

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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/*
data/README.textile CHANGED
@@ -8,26 +8,47 @@ This plugin is an active_merchant patch for china online payment platform, now i
8
8
 
9
9
  h2. Install
10
10
 
11
- install active_merchant plugin first:
11
+ install active_merchant and activemerchant_patch_for_china as plugins:
12
+
12
13
  <pre><code>
13
14
  script/plugin install git://github.com/Shopify/active_merchant.git
15
+ script/plugin install git://github.com/flyerhzm/activemerchant_patch_for_china.git
14
16
  </code></pre>
15
17
 
16
- then, install activemerchant_patch_for_china plugin:
18
+ install activemerchant and activemerchant_patch_for_china as gems:
19
+
17
20
  <pre><code>
18
- script/plugin install git://github.com/flyerhzm/activemerchant_patch_for_china.git
21
+ sudo gem install activemerchant
22
+ sudo gem install activemerchant_patch_for_china
19
23
  </code></pre>
20
24
 
25
+
26
+
21
27
  **************************************************************************
22
28
 
23
29
  h2. Configuration
24
30
 
25
31
  if you install active_merchant and activemerchant_patch_for_china as rails plugins, then define plugin load order in <code>config/environment.rb</code> to promise activemerchant_patch_for_china is loaded after active_merchant.
32
+
26
33
  <pre><code>
27
34
  config.plugins = [:all, :active_merchant, :activemerchant_patch_for_china]
28
35
  </code></pre>
29
36
 
30
- define your api key, account and email in development
37
+ if you install activemerchant and activemerchant_patch_for_china as gems, then define in <code>config/environment.rb</code>
38
+
39
+ <pre><code>
40
+ config.gem "activemerchant", :lib => "active_merchant"
41
+ config.gem "activemerchant_patch_for_china", :lib => false
42
+
43
+
44
+ require 'active_merchant'
45
+ require 'active_merchant/billing/integrations/action_view_helper'
46
+
47
+ ActionView::Base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
48
+ </code></pre>
49
+
50
+ then define your api key, account and email
51
+
31
52
  <pre><code>
32
53
  ActiveMerchant::Billing::Integrations::Alipay::KEY
33
54
  ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT
@@ -39,15 +60,17 @@ ActiveMerchant::Billing::Integrations::Alipay::EMAIL
39
60
  h2. Usage
40
61
 
41
62
  <pre><code>
42
- <% payment_service_for 'payment order', ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT,
63
+ <% payment_service_for 'payment code', ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT,
43
64
  :service => :alipay,
44
65
  :html => { :id => 'payment-form', :method => :get } do |service| %>
45
- <% service.amount '0.01' %>
66
+ <% service.total_fee 0.02 %>
67
+ <%# service.price 0.01 %>
68
+ <%# service.quantity 2 %>
46
69
  <% service.seller :email => ActiveMerchant::Billing::Integrations::Alipay::EMAIL %>
47
70
  <% service.notify_url url_for(:only_path => false, :action => 'notify') %>
48
71
  <% service.return_url url_for(:only_path => false, :action => 'done') %>
49
72
  <% service.show_url url_for(:only_path => false, :action => 'show') %>
50
- <% service.description 'payment description' %>
73
+ <% service.body 'payment body' %>
51
74
  <% service.charset "utf-8" %>
52
75
  <% service.service "create_direct_pay_by_user" %>
53
76
  <% service.payment_type 1 %>
@@ -57,6 +80,11 @@ h2. Usage
57
80
  <%= button_to_function "Submit", "document.getElementById('payment-form').submit();" %>
58
81
  </code></pre>
59
82
 
83
+ *payment code is the out_trade_no, it must be unique.*
84
+ amount is the total_fee.
85
+ payment body is the body of the payment.
86
+ payment subject is the subject of the payment.
87
+
60
88
  **************************************************************************
61
89
 
62
90
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{activemerchant_patch_for_china}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Richard Huang"]
12
+ s.date = %q{2009-11-25}
13
+ s.description = %q{A rails plugin to add an active_merchant patch for china online payment platform}
14
+ s.email = %q{flyerhzm@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.textile"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "MIT-LICENSE",
21
+ "README.textile",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "activemerchant_patch_for_china.gemspec",
25
+ "lib/active_merchant/billing/integrations/alipay.rb",
26
+ "lib/active_merchant/billing/integrations/alipay/helper.rb",
27
+ "lib/active_merchant/billing/integrations/alipay/notification.rb",
28
+ "lib/active_merchant/billing/integrations/alipay/return.rb",
29
+ "lib/active_merchant/billing/integrations/alipay/sign.rb",
30
+ "lib/active_merchant/billing/integrations/bill99.rb",
31
+ "lib/active_merchant/billing/integrations/bill99/helper.rb",
32
+ "lib/active_merchant/billing/integrations/bill99/return.rb",
33
+ "lib/active_merchant/billing/integrations/tenpay.rb",
34
+ "lib/active_merchant/billing/integrations/tenpay/helper.rb",
35
+ "lib/active_merchant/billing/integrations/tenpay/return.rb",
36
+ "lib/activemerchant_patch_for_china.rb",
37
+ "lib/integrations_helper.rb",
38
+ "rails/init.rb",
39
+ "test/activemerchant_patch_for_china_test.rb",
40
+ "test/test_helper.rb"
41
+ ]
42
+ s.homepage = %q{http://github.com/flyerhzm/activemerchant_patch_for_china}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.5}
46
+ s.summary = %q{A rails plugin to add an active_merchant patch for china online payment platform}
47
+ s.test_files = [
48
+ "test/activemerchant_patch_for_china_test.rb",
49
+ "test/test_helper.rb"
50
+ ]
51
+
52
+ if s.respond_to? :specification_version then
53
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
+ s.specification_version = 3
55
+
56
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<activemerchant>, [">= 1.4.2"])
58
+ else
59
+ s.add_dependency(%q<activemerchant>, [">= 1.4.2"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<activemerchant>, [">= 1.4.2"])
63
+ end
64
+ end
65
+
@@ -7,21 +7,31 @@ module ActiveMerchant #:nodoc:
7
7
  module Alipay
8
8
  class Helper < ActiveMerchant::Billing::Integrations::Helper
9
9
  mapping :account, 'partner'
10
- mapping :amount, 'total_fee'
10
+ mapping :total_fee, 'total_fee'
11
+ mapping :price, 'price'
12
+ mapping :quantity, 'quantity'
11
13
 
12
14
  mapping :order, 'out_trade_no'
13
15
 
14
- mapping :seller, :email => 'seller_email'
16
+ mapping :seller, :email => 'seller_email',
17
+ :id => 'seller_id'
18
+ mapping :buyer, :email => 'buyer_email',
19
+ :id => 'buyer_id'
15
20
 
16
21
  mapping :notify_url, 'notify_url'
17
22
  mapping :return_url, 'return_url'
18
23
  mapping :show_url, 'show_url'
19
- mapping :description, 'body'
24
+ mapping :body, 'body'
25
+ mapping :subject, 'subject'
20
26
 
21
27
  mapping :charset, '_input_charset'
22
28
  mapping :service, 'service'
23
29
  mapping :payment_type, 'payment_type'
24
- mapping :subject, 'subject'
30
+ mapping :paymethod, 'paymethod'
31
+ mapping :defaultbank, 'defaultbank'
32
+ mapping :royalty_type, 'royalty_type'
33
+ mapping :royalty_parameters, 'royalty_parameters'
34
+ mapping :it_b_pay, 'it_b_pay'
25
35
 
26
36
  def initialize(order, account, options = {})
27
37
  super
@@ -21,56 +21,90 @@ module ActiveMerchant #:nodoc:
21
21
  true
22
22
  end
23
23
 
24
- def order
25
- @params["out_trade_no"]
26
- end
27
-
28
- def amount
29
- @params["total_fee"]
30
- end
31
-
32
24
  def message
33
25
  @message
34
26
  end
35
27
 
36
- def item_id
37
- params['']
28
+ def notify_id
29
+ params['notify_id']
38
30
  end
39
-
40
- def transaction_id
41
- params['']
31
+
32
+ def notify_time
33
+ Time.parse params['notify_time']
42
34
  end
43
35
 
44
- # When was this payment received by the client.
45
- def received_at
46
- params['']
36
+ def out_trade_no
37
+ params['out_trade_no']
47
38
  end
48
39
 
49
- def payer_email
50
- params['']
40
+ def trade_no
41
+ params['trade_no']
42
+ end
43
+
44
+ def payment_type
45
+ params['payment_type']
46
+ end
47
+
48
+ def subject
49
+ params['subject']
50
+ end
51
+
52
+ def body
53
+ params['body']
51
54
  end
52
55
 
53
- def receiver_email
54
- params['']
56
+ def price
57
+ params['price']
58
+ end
59
+
60
+ def quantity
61
+ params['quantity']
55
62
  end
56
63
 
57
- def security_key
58
- params['']
64
+ def total_fee
65
+ params["total_fee"]
59
66
  end
60
67
 
61
- # the money amount we received in X.2 decimal.
62
- def gross
63
- params['']
68
+ def trade_status
69
+ params['trade_status']
70
+ end
71
+
72
+ def refund_status
73
+ params['refund_status']
74
+ end
75
+
76
+ def seller_email
77
+ params['seller_email']
78
+ end
79
+
80
+ def seller_id
81
+ params['seller_id']
64
82
  end
65
83
 
66
- # Was this a test transaction?
67
- def test?
68
- params[''] == 'test'
84
+ def buyer_email
85
+ params['buyer_email']
69
86
  end
70
87
 
71
- def status
72
- params['trade_status']
88
+ def buyer_id
89
+ params['buyer_id']
90
+ end
91
+
92
+ def gmt_create
93
+ Time.parse params['gmt_create']
94
+ end
95
+
96
+ def gmt_payment
97
+ Time.parse params['gmt_payment']
98
+ end
99
+
100
+ def gmt_close
101
+ Time.parse params['gmt_close']
102
+ end
103
+
104
+ def gmt_refund
105
+ Time.parse params['gmt_reund']
73
106
  end
107
+
74
108
  private
75
109
 
76
110
  # Take the posted data and move the relevant data into a hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant_patch_for_china
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 +08:00
12
+ date: 2009-11-25 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,10 +31,12 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - README.textile
33
33
  files:
34
+ - .gitignore
34
35
  - MIT-LICENSE
35
36
  - README.textile
36
37
  - Rakefile
37
38
  - VERSION
39
+ - activemerchant_patch_for_china.gemspec
38
40
  - lib/active_merchant/billing/integrations/alipay.rb
39
41
  - lib/active_merchant/billing/integrations/alipay/helper.rb
40
42
  - lib/active_merchant/billing/integrations/alipay/notification.rb