def delete(self, payment_method_token, options={}): Resource.verify_keys(options, PaymentMethod.delete_signature()) query_param = "" if options: if 'revoke_all_grants' in options: options['revoke_all_grants'] = str(options['revoke_all_grants']).lower() query_param = "?" + urlencode(options) self.config.http().delete(self.config.base_merchant_path() + "/payment_methods/any/" + payment_method_token + query_param) return SuccessfulResult()
def method(**kw): method = { 'card_type': 'visa', 'created_at': datetime.now(), 'last_4': '7890', 'token': 'da-token', 'updated_at': datetime.now(), } method.update(**kw) return PaymentMethod(None, method)
def update(self, payment_method_token, params): Resource.verify_keys(params, PaymentMethod.update_signature()) try: if payment_method_token is None or payment_method_token.strip() == "": raise NotFoundError() return self._put( "/payment_methods/any/" + payment_method_token, {"payment_method": params} ) except NotFoundError: raise NotFoundError("payment method with token " + repr(payment_method_token) + " not found")
def create(self, params={}): Resource.verify_keys(params, PaymentMethod.create_signature()) return self._post("/payment_methods", {"payment_method": params})
def create(self, params=None): if params is None: params = {} Resource.verify_keys(params, PaymentMethod.create_signature()) self.__check_for_deprecated_attributes(params) return self._post("/payment_methods", {"payment_method": params})