class Reservation

Public Class Methods

new(endpoints, username, password) click to toggle source
# File lib/payment/Reservation.rb, line 11
def initialize(endpoints, username, password)
  @endpoints=endpoints
  @username=username
  @password=password
end

Public Instance Methods

chargeAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId) click to toggle source
# File lib/payment/Reservation.rb, line 167
def chargeAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
  baseurl=@endpoints.getAmountReservationChargeEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('transactionId',transactionId)
  if baseurl.index('{transactionId}')!=nil then
    baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('description',description)
  formparameters.put('currency',currency)
  formparameters.put('amount',amount)
  formparameters.put('referenceSequence',referenceSequence)
  formparameters.put('code',code)
  formparameters.put('clientCorrelator',clientCorrelator)
  formparameters.put('onBehalfOf',onBehalfOf)
  formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
  formparameters.put('channel',channel)
  formparameters.put('taxAmount',taxAmount)
  formparameters.put('serviceId',serviceId)
  formparameters.put('productId',productId)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
chargeAmountWithCallback(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,callbackURL,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId) click to toggle source
# File lib/payment/Reservation.rb, line 213
def chargeAmountWithCallback(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,callbackURL,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
  baseurl=@endpoints.getAmountReservationChargeEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('transactionId',transactionId)
  if baseurl.index('{transactionId}')!=nil then
    baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('description',description)
  formparameters.put('currency',currency)
  formparameters.put('amount',amount)
  formparameters.put('referenceSequence',referenceSequence)
  formparameters.put('code',code)
  formparameters.put('callbackURL',callbackURL)
  formparameters.put('clientCorrelator',clientCorrelator)
  formparameters.put('onBehalfOf',onBehalfOf)
  formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
  formparameters.put('channel',channel)
  formparameters.put('taxAmount',taxAmount)
  formparameters.put('serviceId',serviceId)
  formparameters.put('productId',productId)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
getEndpoints() click to toggle source
# File lib/payment/Reservation.rb, line 16
def getEndpoints
  @endpoints
end
getPassword() click to toggle source
# File lib/payment/Reservation.rb, line 32
def getPassword
  @password
end
getUsername() click to toggle source
# File lib/payment/Reservation.rb, line 24
def getUsername
  @username
end
releaseReservation(endUserId,transactionId,referenceCode,referenceSequence) click to toggle source
# File lib/payment/Reservation.rb, line 260
def releaseReservation(endUserId,transactionId,referenceCode,referenceSequence)
  baseurl=@endpoints.getAmountReservationReleaseEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('transactionId',transactionId)
  if baseurl.index('{transactionId}')!=nil then
    baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('referenceSequence',referenceSequence)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
reserveAdditionalAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId) click to toggle source
# File lib/payment/Reservation.rb, line 82
def reserveAdditionalAmount(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
  baseurl=@endpoints.getAmountReserveAdditionalEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('transactionId',transactionId)
  if baseurl.index('{transactionId}')!=nil then
    baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('description',description)
  formparameters.put('currency',currency)
  formparameters.put('amount',amount)
  formparameters.put('referenceSequence',referenceSequence)
  formparameters.put('code',code)
  formparameters.put('clientCorrelator',clientCorrelator)
  formparameters.put('onBehalfOf',onBehalfOf)
  formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
  formparameters.put('channel',channel)
  formparameters.put('taxAmount',taxAmount)
  formparameters.put('serviceId',serviceId)
  formparameters.put('productId',productId)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
reserveAdditionalAmountSimple(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code) click to toggle source
# File lib/payment/Reservation.rb, line 128
def reserveAdditionalAmountSimple(endUserId,transactionId,referenceCode,description,currency,amount,referenceSequence,code)
  baseurl=@endpoints.getAmountReserveAdditionalEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('transactionId',transactionId)
  if baseurl.index('{transactionId}')!=nil then
    baseurl=baseurl.gsub('{transactionId}',CGI::escape(transactionId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('description',description)
  formparameters.put('currency',currency)
  formparameters.put('amount',amount)
  formparameters.put('referenceSequence',referenceSequence)
  formparameters.put('code',code)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
reserveInitialAmount(endUserId,referenceCode,description,currency,amount,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId) click to toggle source
# File lib/payment/Reservation.rb, line 41
def reserveInitialAmount(endUserId,referenceCode,description,currency,amount,code,clientCorrelator,onBehalfOf,purchaseCategoryCode,channel,taxAmount,serviceId,productId)
  baseurl=@endpoints.getAmountReserveEndpoint()
  requestProcessor=JSONRequest.new()
  formparameters=FormParameters.new()
  formparameters.put('endUserId',endUserId)
  if baseurl.index('{endUserId}')!=nil then
    baseurl=baseurl.gsub('{endUserId}',CGI::escape(endUserId.to_s))
  end
  formparameters.put('referenceCode',referenceCode)
  formparameters.put('description',description)
  formparameters.put('currency',currency)
  formparameters.put('amount',amount)
  formparameters.put('code',code)
  formparameters.put('clientCorrelator',clientCorrelator)
  formparameters.put('onBehalfOf',onBehalfOf)
  formparameters.put('purchaseCategoryCode',purchaseCategoryCode)
  formparameters.put('channel',channel)
  formparameters.put('taxAmount',taxAmount)
  formparameters.put('serviceId',serviceId)
  formparameters.put('productId',productId)
  postdata=formparameters.encodeParameters()
  rawresponse=requestProcessor.post(baseurl,postdata,'application/json', @username, @password)
  response=AmountReservationResponse.new()
  if (rawresponse!=nil) && (rawresponse.getContent()!=nil)
    jsondata=JSON.parse(rawresponse.getContent())
    if (jsondata!=nil) && (jsondata['amountReservationTransaction']!=nil) then
      response.setAmountReservationTransactionJSON(jsondata['amountReservationTransaction'])
    end
  end
  if rawresponse.getCode()!=nil then
    response.setHTTPResponseCode(rawresponse.getCode())
  end
  if rawresponse.getLocation()!=nil then
    response.setLocation(rawresponse.getLocation())
  end
  if rawresponse.getContentType()!=nil then
    response.setContentType(rawresponse.getContentType())
  end
  return response
end
setEndpoints(endpoints) click to toggle source
# File lib/payment/Reservation.rb, line 20
def setEndpoints(endpoints)
  @endpoints=endpoints
end
setPassword(password) click to toggle source
# File lib/payment/Reservation.rb, line 36
def setPassword(password)
  @password=password
end
setUsername(username) click to toggle source
# File lib/payment/Reservation.rb, line 28
def setUsername(username)
  @username=username
end