def delete_customer_profile(self): """Delete a Customer Profile""" if not self.instance.authorizenet_customer_profile_id: # try refereshing from database in case the model has been updated self.instance.refresh_from_db() # nothing has been updated and the ID is still None if not self.instance.authorizenet_customer_profile_id: msg = 'Cannot delete the profile id because it is not ' \ 'saved on the model' raise ValueError(msg) deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = self.merchantAuth deleteCustomerProfile.customerProfileId = str( self.instance.authorizenet_customer_profile_id) controller = deleteCustomerProfileController(deleteCustomerProfile) controller.setenvironment(self.post_url) controller.execute() response = controller.getresponse() if response.messages.resultCode == OK: print('deleted customer profile', self.instance.authorizenet_customer_profile_id) self.instance.authorizenet_customer_profile_id = None return True else: print(response.messages.message[0]['text'].text) raise AuthorizeNetError(response.messages.message[0]['text'].text)
def deleteCustomerProfile(customerProfileId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '4urP8Y47' merchantAuth.transactionKey = '538g4Tg2uMBte3W8' deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = merchantAuth deleteCustomerProfile.customerProfileId = customerProfileId controller = deleteCustomerProfileController(deleteCustomerProfile) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): response = ( "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId) print("Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId) else: print(response.messages.message[0]['text'].text) print("Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId) response = ( "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId) return response
def delete_customer_profile(customerProfileId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = merchantAuth deleteCustomerProfile.customerProfileId = customerProfileId controller = deleteCustomerProfileController(deleteCustomerProfile) controller.execute() response = controller.getresponse() if (response.messages.resultCode=="Ok"): print("Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId) else: print(response.messages.message[0]['text'].text) print("Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId) return response
def delete_customer_profile(customerProfileId): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = merchantAuth deleteCustomerProfile.customerProfileId = customerProfileId controller = deleteCustomerProfileController(deleteCustomerProfile) controller.execute() response = controller.getresponse() if (response.messages.resultCode == "Ok"): print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId else: print response.messages.message[0].text print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId return response
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = merchantAuth deleteCustomerProfile.customerProfileId = "36152115" deleteCustomerProfileController = deleteCustomerProfileController(deleteCustomerProfile) deleteCustomerProfileController.execute() response = deleteCustomerProfileController.getresponse() if (response.messages.resultCode=="Ok"): print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId else: print response.messages.message[0].text print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' deleteCustomerProfile = apicontractsv1.deleteCustomerProfileRequest() deleteCustomerProfile.merchantAuthentication = merchantAuth deleteCustomerProfile.customerProfileId = "36152115" deleteCustomerProfileController = deleteCustomerProfileController( deleteCustomerProfile) deleteCustomerProfileController.execute() response = deleteCustomerProfileController.getresponse() if (response.messages.resultCode == "Ok"): print "Successfully deleted customer with customer profile id %s" % deleteCustomerProfile.customerProfileId else: print response.messages.message[0].text print "Failed to delete customer profile with customer profile id %s" % deleteCustomerProfile.customerProfileId