activemerchant_patch_for_china 0.1.1 → 0.1.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.
data/README.textile CHANGED
@@ -59,6 +59,10 @@ ActiveMerchant::Billing::Integrations::Alipay::EMAIL
59
59
 
60
60
  h2. Usage
61
61
 
62
+ *Alipay*
63
+
64
+ Request Form:
65
+
62
66
  <pre><code>
63
67
  <% payment_service_for 'payment code', ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT,
64
68
  :service => :alipay,
@@ -85,6 +89,95 @@ amount is the total_fee.
85
89
  payment body is the body of the payment.
86
90
  payment subject is the subject of the payment.
87
91
 
92
+
93
+ Notify action:
94
+
95
+ <pre><code>
96
+ notification = ActiveMerchant::Billing::Integrations::Alipay::Notification.new(request.raw_post)
97
+
98
+ txn = AlipayTxn.create(:notify_id => notification.notify_id,
99
+ :total_fee => notification.total_fee,
100
+ :status => notification.trade_status,
101
+ :trade_no => notification.trade_no,
102
+ :received_at => notification.notify_time)
103
+
104
+ if notification.complete?
105
+ txn.pay!
106
+ else
107
+ txn.pending!
108
+ end
109
+ </code></pre>
110
+
111
+ Return action:
112
+
113
+ <pre><code>
114
+ def done
115
+ r = ActiveMerchant::Billing::Integrations::Alipay::Return.new(request.query_string)
116
+ unless @result = r.success?
117
+ logger.warn(r.message)
118
+ end
119
+ end
120
+ </code></pre>
121
+
122
+ **************************************************************************
123
+
124
+ h2. Interface
125
+
126
+ *Alipay*
127
+
128
+ for helper
129
+
130
+ <pre><code>
131
+ mapping :account, 'partner'
132
+ mapping :total_fee, 'total_fee'
133
+ mapping :price, 'price'
134
+ mapping :quantity, 'quantity'
135
+ mapping :order, 'out_trade_no'
136
+ mapping :seller, :email => 'seller_email',
137
+ :id => 'seller_id'
138
+ mapping :buyer, :email => 'buyer_email',
139
+ :id => 'buyer_id'
140
+ mapping :notify_url, 'notify_url'
141
+ mapping :return_url, 'return_url'
142
+ mapping :show_url, 'show_url'
143
+ mapping :body, 'body'
144
+ mapping :subject, 'subject'
145
+ mapping :charset, '_input_charset'
146
+ mapping :service, 'service'
147
+ mapping :payment_type, 'payment_type'
148
+ mapping :paymethod, 'paymethod'
149
+ mapping :defaultbank, 'defaultbank'
150
+ mapping :royalty_type, 'royalty_type'
151
+ mapping :royalty_parameters, 'royalty_parameters'
152
+ mapping :it_b_pay, 'it_b_pay'
153
+ </code></pre>
154
+
155
+ for notification
156
+
157
+ <pre><code>
158
+ notify_type
159
+ notify_id
160
+ notify_time
161
+ out_trade_no
162
+ trade_no
163
+ payment_type
164
+ subject
165
+ body
166
+ price
167
+ quantity
168
+ total_fee
169
+ trade_status
170
+ refund_status
171
+ seller_email
172
+ seller_id
173
+ buyer_email
174
+ buyer_id
175
+ gmt_create
176
+ gmt_payment
177
+ gmt_close
178
+ gmt_refund
179
+ </code></pre>
180
+
88
181
  **************************************************************************
89
182
 
90
183
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{activemerchant_patch_for_china}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Richard Huang"]
@@ -24,6 +24,10 @@ module ActiveMerchant #:nodoc:
24
24
  def message
25
25
  @message
26
26
  end
27
+
28
+ def notify_type
29
+ params['notify_type']
30
+ end
27
31
 
28
32
  def notify_id
29
33
  params['notify_id']
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang