Class: Cetustek::CancelAllowance

Inherits:
Object
  • Object
show all
Defined in:
lib/cetustek/cancel_allowance.rb

Overview

2.10 CancelAllowance 作廢折讓單. Returns "C0" on success, raises ResultError otherwise.

Constant Summary collapse

SUCCESS_CODE =
'C0'
RESULT_MESSAGES =

Spec AVM-26-03 Table 19.

{
  'M:' => '欄位未填或格式錯誤',
  'M1' => 'XML 格式錯誤',
  'C1' => '上傳失敗',
  'C2' => '折讓單已申報,無法作廢',
  'C3' => '折讓單號不存在或須為已確認後的折讓單',
  'C4' => '該作廢折讓單已經上傳',
  'C5' => '折讓單已過作廢期限,無法作廢',
  'Invalid' => '無效 IP,請通知系統商'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(allowance_number, reason) ⇒ CancelAllowance

Returns a new instance of CancelAllowance.



23
24
25
26
# File 'lib/cetustek/cancel_allowance.rb', line 23

def initialize(allowance_number, reason)
  @allowance_number = allowance_number
  @reason = reason
end

Instance Method Details

#executeObject



28
29
30
31
32
# File 'lib/cetustek/cancel_allowance.rb', line 28

def execute
  perform
  ResultCode.check!(@response.body[:cancel_allowance_response][:return],
                    RESULT_MESSAGES, success: SUCCESS_CODE)
end