Class: OffsitePayments::Integrations::Pay2goCvs::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pay2goCvs::Notification
- Defined in:
- lib/offsite_payments/integrations/pay2go_cvs.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
- #calculate_checksum ⇒ 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
Pay2goCvs 端訂單號碼.
Instance Attribute Details
#_params ⇒ Object
Returns the value of attribute _params.
97 98 99 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 97 def _params @_params end |
Instance Method Details
#acknowledge ⇒ Object
TODO 使用查詢功能實作 acknowledge 而以 checksum_ok? 代替
113 114 115 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 113 def acknowledge checksum_ok? end |
#amt ⇒ Object
155 156 157 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 155 def amt _params['Amt'].to_s end |
#auth ⇒ Object
206 207 208 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 206 def auth _params['Auth'] end |
#barcode_1 ⇒ Object
barcode
253 254 255 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 253 def _params['Barcode_1'] end |
#barcode_2 ⇒ Object
257 258 259 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 257 def _params['Barcode_2'] end |
#barcode_3 ⇒ Object
261 262 263 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 261 def _params['Barcode_3'] end |
#calculate_checksum ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 124 def calculate_checksum 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::Pay2goCvs.hash_iv}&#{raw_data}&HashKey=#{OffsitePayments::Integrations::Pay2goCvs.hash_key}" sha256 = Digest::SHA256.new sha256.update hash_raw_data.force_encoding("utf-8") sha256.hexdigest.upcase end |
#card_4no ⇒ Object
214 215 216 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 214 def card_4no _params['Card4No'] end |
#card_6no ⇒ Object
210 211 212 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 210 def card_6no _params['Card6No'] end |
#check_code ⇒ Object
185 186 187 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 185 def check_code _params['CheckCode'] end |
#checksum_ok? ⇒ Boolean
139 140 141 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 139 def checksum_ok? calculate_checksum == check_code.to_s end |
#code_no ⇒ Object
cvs
248 249 250 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 248 def code_no _params['CodeNo'] end |
#complete? ⇒ Boolean
117 118 119 120 121 122 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 117 def complete? case status when 'SUCCESS' # 付款/取號成功 true end end |
#eci ⇒ Object
230 231 232 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 230 def eci _params['ECI'] end |
#escrow_bank ⇒ Object
197 198 199 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 197 def escrow_bank _params['EscrowBank'] end |
#expire_date ⇒ Object
other about serials
266 267 268 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 266 def expire_date _params['ExpireDate'] end |
#inst ⇒ Object
218 219 220 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 218 def inst _params['Inst'] end |
#inst_each ⇒ Object
226 227 228 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 226 def inst_each _params['InstEach'] end |
#inst_first ⇒ Object
222 223 224 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 222 def inst_first _params['InstFirst'] end |
#ip ⇒ Object
193 194 195 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 193 def ip _params['IP'] end |
#item_id ⇒ Object
訂單號碼
160 161 162 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 160 def item_id merchant_order_no end |
#merchant_id ⇒ Object
151 152 153 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 151 def merchant_id _params['MerchantID'] end |
#merchant_order_no ⇒ Object
173 174 175 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 173 def merchant_order_no _params['MerchantOrderNo'] end |
#message ⇒ Object
147 148 149 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 147 def URI.decode(_params['Message']) end |
#pay_bank_code ⇒ Object
web atm, atm
239 240 241 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 239 def pay_bank_code _params['PayBankCode'] end |
#pay_time ⇒ Object
189 190 191 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 189 def pay_time URI.decode(_params['PayTime']).gsub("+", " ") end |
#payer_account_5code ⇒ Object
243 244 245 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 243 def payer_account_5code _params['PayerAccount5Code'] end |
#payment_type ⇒ Object
177 178 179 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 177 def payment_type _params['PaymentType'] end |
#respond_code ⇒ Object
credit card
202 203 204 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 202 def respond_code _params['RespondCode'] end |
#respond_type ⇒ Object
181 182 183 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 181 def respond_type _params['RespondType'] end |
#status ⇒ Object
143 144 145 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 143 def status _params['Status'] end |
#token_use_status ⇒ Object
234 235 236 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 234 def token_use_status _params['TokenUseStatus'] end |
#trade_no ⇒ Object
169 170 171 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 169 def trade_no _params['TradeNo'] end |
#transaction_id ⇒ Object
Pay2goCvs 端訂單號碼
165 166 167 |
# File 'lib/offsite_payments/integrations/pay2go_cvs.rb', line 165 def transaction_id trade_no end |