def test_to_uri_with_request_parameters(self): """Tests if the communicator can correctly construct an url using a known base url, a relative url and a list of request parameters """ requestparams = [ RequestParam("amount", "123"), RequestParam("source", "USD"), RequestParam("target", "EUR"), RequestParam("dummy", "é&%=") ] patcher = patch( 'ingenico.connect.sdk.session.Session', api_endpoint=urlparse("https://api-sandbox.globalcollect.com")) session = patcher.start() communicator = Communicator(session, DefaultMarshaller.INSTANCE()) uri1 = communicator._to_absolute_uri("v1/merchant/20000/convertamount", requestparams) uri2 = communicator._to_absolute_uri( "/v1/merchant/20000/convertamount", requestparams) self.assertEqual( "https://api-sandbox.globalcollect.com/v1/merchant/20000/convertamount" "?amount=123&source=USD&target=EUR&dummy=%C3%A9%26%25%3D", uri1.geturl()) self.assertEqual( "https://api-sandbox.globalcollect.com/v1/merchant/20000/convertamount" "?amount=123&source=USD&target=EUR&dummy=%C3%A9%26%25%3D", uri2.geturl())
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.country_code is not None: result.append(RequestParam("countryCode", self.country_code)) if self.currency_code is not None: result.append(RequestParam("currencyCode", self.currency_code)) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.locale is not None: result.append(RequestParam("locale", self.locale)) if self.payment_product_id is not None: result.append( RequestParam("paymentProductId", str(self.payment_product_id))) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.source is not None: result.append(RequestParam("source", self.source)) if self.target is not None: result.append(RequestParam("target", self.target)) if self.amount is not None: result.append(RequestParam("amount", str(self.amount))) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.country_code is not None: result.append(RequestParam("countryCode", self.country_code)) if self.currency_code is not None: result.append(RequestParam("currencyCode", self.currency_code)) if self.amount is not None: result.append(RequestParam("amount", str(self.amount))) if self.is_recurring is not None: result.append(RequestParam("isRecurring", str(self.is_recurring))) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.hosted_checkout_id is not None: result.append(RequestParam("hostedCheckoutId", self.hosted_checkout_id)) if self.merchant_reference is not None: result.append(RequestParam("merchantReference", self.merchant_reference)) if self.merchant_order_id is not None: result.append(RequestParam("merchantOrderId", str(self.merchant_order_id))) if self.offset is not None: result.append(RequestParam("offset", str(self.offset))) if self.limit is not None: result.append(RequestParam("limit", str(self.limit))) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.mandate_cancel_date is not None: result.append(RequestParam("mandateCancelDate", self.mandate_cancel_date)) return result
def to_request_parameters(self): """ :return: list[RequestParam] """ result = [] if self.country_code is not None: result.append(RequestParam("countryCode", self.country_code)) if self.currency_code is not None: result.append(RequestParam("currencyCode", self.currency_code)) if self.locale is not None: result.append(RequestParam("locale", self.locale)) if self.amount is not None: result.append(RequestParam("amount", str(self.amount))) if self.is_recurring is not None: result.append(RequestParam("isRecurring", str(self.is_recurring))) if self.hide is not None: for hide_element in self.hide: if hide_element is not None: result.append(RequestParam("hide", hide_element)) if self.force_basic_flow is not None: result.append( RequestParam("forceBasicFlow", str(self.force_basic_flow))) return result