public void SampleCodeCreateCustomerProfileFromTransaction() { LogHelper.info(Logger, "Sample createCustomerProfileFromTransaction"); ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = CustomMerchantAuthenticationType; ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = TestEnvironment; //setup transaction to use var transactionId = GetTransactionId(); var createRequest = new createCustomerProfileFromTransactionRequest { refId = RefId, transId = transactionId.ToString(CultureInfo.InvariantCulture), }; //execute and get response var createController = new createCustomerProfileFromTransactionController(createRequest); var createResponse = createController.ExecuteWithApiResponse(); //validate Assert.NotNull(createResponse); Assert.NotNull(createResponse.messages); Assert.AreEqual(messageTypeEnum.Ok, createResponse.messages.resultCode); Assert.NotNull(createResponse.customerProfileId); Assert.NotNull(createResponse.customerPaymentProfileIdList); Assert.AreNotEqual(0, createResponse.customerPaymentProfileIdList.Length); long customerProfileId; long.TryParse(createResponse.customerProfileId, out customerProfileId); Assert.AreNotEqual(0, customerProfileId); long customerPaymentProfileId; long.TryParse(createResponse.customerPaymentProfileIdList[0], out customerPaymentProfileId); Assert.AreNotEqual(0, customerPaymentProfileId); //if shipping profile is added, shipping profile id will be retrieved too }
public void SampleCodeCreateCustomerProfileFromTransaction() { LogHelper.info(Logger, "Sample createCustomerProfileFromTransaction"); ApiOperationBase <ANetApiRequest, ANetApiResponse> .MerchantAuthentication = CustomMerchantAuthenticationType; ApiOperationBase <ANetApiRequest, ANetApiResponse> .RunEnvironment = TestEnvironment; //setup transaction to use var transactionId = GetTransactionId(); var createRequest = new createCustomerProfileFromTransactionRequest { refId = RefId, transId = transactionId.ToString(CultureInfo.InvariantCulture), }; //execute and get response var createController = new createCustomerProfileFromTransactionController(createRequest); var createResponse = createController.ExecuteWithApiResponse(); //validate Assert.NotNull(createResponse); Assert.NotNull(createResponse.messages); Assert.AreEqual(messageTypeEnum.Ok, createResponse.messages.resultCode); Assert.NotNull(createResponse.customerProfileId); Assert.NotNull(createResponse.customerPaymentProfileIdList); Assert.AreNotEqual(0, createResponse.customerPaymentProfileIdList.Length); long customerProfileId; long.TryParse(createResponse.customerProfileId, out customerProfileId); Assert.AreNotEqual(0, customerProfileId); long customerPaymentProfileId; long.TryParse(createResponse.customerPaymentProfileIdList[0], out customerPaymentProfileId); Assert.AreNotEqual(0, customerPaymentProfileId); //if shipping profile is added, shipping profile id will be retrieved too }