def __validate_refund_status(refund_status_detail): MerchantProperty.logger.info( "Refund :: validate refund status for refund_status_detail: {}". format(refund_status_detail)) if is_empty(refund_status_detail.get_order_id())\ or is_empty(refund_status_detail.get_ref_id()): MerchantProperty.logger.debug("validate refund status is false") raise SDKException.get_missing_mandatory_parameters_exception() MerchantProperty.logger.debug("validate refund_status true")
def __validate_create_txn_token(payment_details): """Checking mandatory field it has or not :param payment_details: :return: if mandatory parameter is not there return SDKException """ MerchantProperty.logger.info("Payment :: validateCreateTxnToken for payment_details: {0} ".format(payment_details)) if is_empty(payment_details.get_order_id()) or not payment_details.get_txn_amount()\ or is_empty(payment_details.get_txn_amount().get_value()) or not payment_details.get_user_info()\ or is_empty(payment_details.get_user_info().get_cust_id()): raise SDKException.get_missing_mandatory_parameters_exception()
def __validate_refund(refund_detail): """validate_refund checks if all mandatory parameters are present for Refund api If not, then is will throw the RequestValidationException exception :param refund_detail: RefundInitiateRequest object :return: raise exception if any mandatory parameter is missing """ MerchantProperty.logger.info( "Refund :: validate_refund for refund_detail : {}".format( refund_detail)) if is_empty(refund_detail.get_order_id())\ or is_empty(refund_detail.get_ref_id())\ or is_empty(refund_detail.get_txn_id())\ or is_empty(refund_detail.get_refund_amount()): raise SDKException.get_missing_mandatory_parameters_exception()
def __validate_get_payment_status(payment_status_detail): """ :param payment_status_detail: :return: will raise exception if there is missing of any mandatory parameter """ MerchantProperty.logger.info( "Payment :: validate_get_payment_status for payment_status_detail: {}".format(payment_status_detail)) if is_empty(payment_status_detail.get_order_id()): raise SDKException.get_missing_mandatory_parameters_exception()
def __get_body_from_response_content(content): if is_empty(content) or ('"body":{' not in content) or ('"head":{' not in content): raise SDKException.get_sdk_exception( "Received response body is not proper.") MerchantProperty.logger.debug( "Request :: get_body_from_response_content content: {}".format( content)) head_idx = content.find(LibraryConstants.HEAD_TEXT, 0, len(content)) start_idx, end_idx = content.find( LibraryConstants.BODY_TEXT, 0, len(content)) + 6, len(content) - ( 2 if content.endswith('\'') else 1) if head_idx > start_idx: end_idx = head_idx - 2 MerchantProperty.logger.debug( "Request :: get_body_from_response_content body: {}".format( content[start_idx:end_idx])) return content[start_idx:end_idx]