module YTLabsApi::Cancellation

Public Instance Methods

get_cancellation_charge(reservation_number) click to toggle source

Parameters:

Required => reseveration_number             Unique reservation number - provided when booking was made.

Example Request: api.ytlabs.co.kr/stage/v1/reservation/cancelcharge?reservationNo=w_WP20160705145532ECD5

Example usage: client.get_cancellation_charge(“w_WP20160705145532ECD5”)

# File lib/ytlabs_api/cancellation.rb, line 45
def get_cancellation_charge(reservation_number)
  response = HTTParty.get(
    "#{build_url(__method__.to_s)}?reservationNo=#{reservation_number}",
    headers: { "Authorization" => token.to_s, "Content-Type" => "#{content_type}" }
  )

  prepare_response(response)
end
post_cancellation_request(reservation_number, paid_price, commission_price, currency) click to toggle source

POST /reservation/cancel/

If a reservation is canceled by the guest, the partner should request /reservation/cancel/ If a real reservation is not completed within 10 minutes after ReservationHolding, Partner should also request /reservation/cancel/

{

"reservationNo" : "w_WP0000000000000000",
"refundPaidPrice" : 2000.0,
"refundCommissionPrice" : 200.0,
"currency" : "KRW"

}

# File lib/ytlabs_api/cancellation.rb, line 16
def post_cancellation_request(reservation_number, paid_price, commission_price, currency)
  request_body = {
             :reservationNo         => "#{reservation_number}",
             :refundPaidPrice       => "#{paid_price}",
             :refundCommissionPrice => "#{commission_price}",
             :currency              => "#{currency}"
           }.to_json

  response = HTTParty.post(
    "#{build_url(__method__.to_s)}",
    body:    request_body,
    headers: { "Authorization" => token.to_s, "Content-Type" => "#{content_type}" }
  )

  prepare_response(response)
end