Class: OffsitePayments::Integrations::Pay2go::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pay2go::Notification
- Defined in:
- lib/offsite_payments/integrations/pay2go.rb
Instance Attribute Summary collapse
-
#_params ⇒ Object
Returns the value of attribute _params.
Instance Method Summary collapse
-
#acknowledge ⇒ Object
TODO 使用查詢功能實作 acknowledge 而以 checksum_ok? 代替.
- #amt ⇒ Object
- #auth ⇒ Object
-
#barcode_1 ⇒ Object
barcode.
- #barcode_2 ⇒ Object
- #barcode_3 ⇒ Object
- #card_4no ⇒ Object
- #card_6no ⇒ Object
- #check_code ⇒ Object
- #checksum_ok? ⇒ Boolean
-
#code_no ⇒ Object
cvs.
- #complete? ⇒ Boolean
- #eci ⇒ Object
- #escrow_bank ⇒ Object
-
#expire_date ⇒ Object
other about serials.
- #inst ⇒ Object
- #inst_each ⇒ Object
- #inst_first ⇒ Object
- #ip ⇒ Object
-
#item_id ⇒ Object
訂單號碼.
- #merchant_id ⇒ Object
- #merchant_order_no ⇒ Object
- #message ⇒ Object
-
#pay_bank_code ⇒ Object
web atm, atm.
- #pay_time ⇒ Object
- #payer_account_5code ⇒ Object
- #payment_type ⇒ Object
-
#respond_code ⇒ Object
credit card.
- #respond_type ⇒ Object
- #status ⇒ Object
- #token_use_status ⇒ Object
- #trade_no ⇒ Object
-
#transaction_id ⇒ Object
Pay2go 端訂單號碼.
Instance Attribute Details
#_params ⇒ Object
Returns the value of attribute _params.
123 124 125 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 123 def _params @_params end |
Instance Method Details
#acknowledge ⇒ Object
TODO 使用查詢功能實作 acknowledge 而以 checksum_ok? 代替
141 142 143 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 141 def acknowledge checksum_ok? end |
#amt ⇒ Object
179 180 181 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 179 def amt _params['Amt'].to_s end |
#auth ⇒ Object
230 231 232 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 230 def auth _params['Auth'] end |
#barcode_1 ⇒ Object
barcode
277 278 279 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 277 def _params['Barcode_1'] end |
#barcode_2 ⇒ Object
281 282 283 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 281 def _params['Barcode_2'] end |
#barcode_3 ⇒ Object
285 286 287 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 285 def _params['Barcode_3'] end |
#card_4no ⇒ Object
238 239 240 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 238 def card_4no _params['Card4No'] end |
#card_6no ⇒ Object
234 235 236 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 234 def card_6no _params['Card6No'] end |
#check_code ⇒ Object
209 210 211 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 209 def check_code _params['CheckCode'] end |
#checksum_ok? ⇒ Boolean
152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 152 def checksum_ok? params_copy = _params.clone check_fields = [:"Amt", :"MerchantID", :"MerchantOrderNo", :"TradeNo"] raw_data = params_copy.sort.map{|field, value| "#{field}=#{value}" if check_fields.include?(field.to_sym) }.compact.join('&') hash_raw_data = "HashIV=#{OffsitePayments::Integrations::Pay2go.hash_iv}&#{raw_data}&HashKey=#{OffsitePayments::Integrations::Pay2go.hash_key}" sha256 = Digest::SHA256.new sha256.update hash_raw_data.force_encoding("utf-8") (sha256.hexdigest.upcase == check_code.to_s) end |
#code_no ⇒ Object
cvs
272 273 274 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 272 def code_no _params['CodeNo'] end |
#complete? ⇒ Boolean
145 146 147 148 149 150 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 145 def complete? case status when 'SUCCESS' # 付款/取號成功 true end end |
#eci ⇒ Object
254 255 256 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 254 def eci _params['ECI'] end |
#escrow_bank ⇒ Object
221 222 223 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 221 def escrow_bank _params['EscrowBank'] end |
#expire_date ⇒ Object
other about serials
290 291 292 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 290 def expire_date _params['ExpireDate'] end |
#inst ⇒ Object
242 243 244 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 242 def inst _params['Inst'] end |
#inst_each ⇒ Object
250 251 252 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 250 def inst_each _params['InstEach'] end |
#inst_first ⇒ Object
246 247 248 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 246 def inst_first _params['InstFirst'] end |
#ip ⇒ Object
217 218 219 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 217 def ip _params['IP'] end |
#item_id ⇒ Object
訂單號碼
184 185 186 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 184 def item_id merchant_order_no end |
#merchant_id ⇒ Object
175 176 177 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 175 def merchant_id _params['MerchantID'] end |
#merchant_order_no ⇒ Object
197 198 199 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 197 def merchant_order_no _params['MerchantOrderNo'] end |
#message ⇒ Object
171 172 173 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 171 def URI.decode(_params['Message']) end |
#pay_bank_code ⇒ Object
web atm, atm
263 264 265 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 263 def pay_bank_code _params['PayBankCode'] end |
#pay_time ⇒ Object
213 214 215 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 213 def pay_time URI.decode(_params['PayTime']).gsub("+", " ") end |
#payer_account_5code ⇒ Object
267 268 269 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 267 def payer_account_5code _params['PayerAccount5Code'] end |
#payment_type ⇒ Object
201 202 203 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 201 def payment_type _params['PaymentType'] end |
#respond_code ⇒ Object
credit card
226 227 228 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 226 def respond_code _params['RespondCode'] end |
#respond_type ⇒ Object
205 206 207 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 205 def respond_type _params['RespondType'] end |
#status ⇒ Object
167 168 169 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 167 def status _params['Status'] end |
#token_use_status ⇒ Object
258 259 260 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 258 def token_use_status _params['TokenUseStatus'] end |
#trade_no ⇒ Object
193 194 195 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 193 def trade_no _params['TradeNo'] end |
#transaction_id ⇒ Object
Pay2go 端訂單號碼
189 190 191 |
# File 'lib/offsite_payments/integrations/pay2go.rb', line 189 def transaction_id trade_no end |