def getStatusByFlowOrder( apiclient: ApiClient, flowOrder: int, ) -> PaymentStatus: """Obtiene el estado de un pago previamente creado, el parametro token hace referencia a notification id, el cual se recibe luego de procesado un pago """ url = f"{apiclient.api_url}/payment/getStatusByFlowOrder" params: Dict[str, Any] = { "apiKey": apiclient.api_key, "flowOrder": flowOrder } signature = apiclient.make_signature(params) params["s"] = signature logging.debug("Before Request:" + str(params)) response = apiclient.get(url, params) if response.status_code == 200: return PaymentStatus.from_dict(cast(Dict[str, Any], response.json())) elif response.status_code == 400: raise GenericError(cast(Dict[str, Any], response.json())) elif response.status_code == 401: raise GenericError(cast(Dict[str, Any], response.json())) else: raise GenericError({"code": response.status_code, "message": response})
def getPayments(apiclient: ApiClient, payment_info: Dict[str, Any]) -> PaymentList: """ Este método permite obtener la lista paginada de pagos recibidos en un día.Los objetos pagos de la lista tienen la misma estructura de los retornados en los servicios payment/getStatus """ url = f"{apiclient.api_url}/payment/getPayments" payment_info["apiKey"] = apiclient.api_key signature = apiclient.make_signature(payment_info) payment_info["s"] = signature logging.debug("Before Request:" + str(payment_info)) response = apiclient.get(url, payment_info) if response.status_code == 200: return PaymentList.from_dict(cast(Dict[str, Any], response.json())) elif response.status_code == 400: raise GenericError(cast(Dict[str, Any], response.json())) elif response.status_code == 401: raise GenericError(cast(Dict[str, Any], response.json())) else: raise GenericError({"code": response.status_code, "message": response})
def getStatus( apiclient: ApiClient, token: str, ) -> RefundStatus: """ Permite obtener el estado de un reembolso solicitado. Este servicio se debe invocar desde la página del comercio que se señaló en el parámetro urlCallback del servicio refund/create. """ url = f"{apiclient.api_url}/refund/getStatus" params: Dict[str, Any] = {"apiKey": apiclient.api_key, "token": token} signature = apiclient.make_signature(params) params["s"] = signature logging.debug("Before Request:" + str(params)) response = apiclient.get(url, params) if response.status_code == 200: return RefundStatus.from_dict(cast(Dict[str, Any], response.json())) elif response.status_code == 400: raise GenericError(cast(Dict[str, Any], response.json())) elif response.status_code == 401: raise GenericError(cast(Dict[str, Any], response.json())) else: raise GenericError({"code": response.status_code, "message": response})