Skip to content

Commit f3054af

Browse files
committed
Zero CIM Test Completed
- Added Separate Sandbox credentials for Zero CIM Test.
1 parent 188aab8 commit f3054af

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

src/test/java/net/authorize/cim/functional_test/CIMTest.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import static org.junit.Assert.fail;
44

55
import java.util.ArrayList;
6+
import net.authorize.Environment;
7+
import net.authorize.Merchant;
68

79
import net.authorize.ResponseField;
810
import net.authorize.Transaction;
@@ -880,35 +882,42 @@ private MyReturnValuesTest createCustomerProfileWithAuthOnly(
880882
@SuppressWarnings("unchecked")
881883
@Test
882884
public void testZeroCustomerProfile() {
885+
886+
// Merchent credientials with zero CIM profiles (should be different from the credentials used for other tests)
887+
// warn: all customer profiles will be deleated for this account for testing purpose
888+
String zeroCIMApiLoginID = "ZERO_CIM_API_LOGIN_ID";
889+
String zeroCIMTransactionKey = "ZERO_CIM_TRANSACTION_KEY";
890+
Merchant zeroCIMMerchant = Merchant.createMerchant( Environment.SANDBOX, zeroCIMApiLoginID, zeroCIMTransactionKey);
891+
883892
// get all existing customer profile ids
884-
net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
885-
Result<Transaction> result = (Result<Transaction>) merchant.postTransaction(transaction);
893+
net.authorize.cim.Transaction transaction = zeroCIMMerchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
894+
Result<Transaction> result = (Result<Transaction>) zeroCIMMerchant.postTransaction(transaction);
886895
ArrayList<String> customerProfileIds = result.getCustomerProfileIdList();
887896

888897
// delete all existing customer profile
889898
for (int i = 0; i < customerProfileIds.size(); i++) {
890-
transaction = merchant.createCIMTransaction(TransactionType.DELETE_CUSTOMER_PROFILE);
899+
transaction = zeroCIMMerchant.createCIMTransaction(TransactionType.DELETE_CUSTOMER_PROFILE);
891900
transaction.setCustomerProfileId(customerProfileIds.get(i));
892-
result = (Result<Transaction>) merchant.postTransaction(transaction);
901+
result = (Result<Transaction>) zeroCIMMerchant.postTransaction(transaction);
893902
}
894903

895904
// test for getCustomerProfileIds request
896-
transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
897-
result = (Result<Transaction>) merchant.postTransaction(transaction);
905+
transaction = zeroCIMMerchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE_IDS);
906+
result = (Result<Transaction>) zeroCIMMerchant.postTransaction(transaction);
898907
Assert.assertNotNull(result);
899908
result.printMessages();
900909
Assert.assertTrue(result.isOk());
901910
Assert.assertTrue(result.getCustomerProfileIdList().isEmpty());
902911

903912
// test for getCustomerProfile request
904-
transaction = merchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE);
913+
transaction = zeroCIMMerchant.createCIMTransaction(TransactionType.GET_CUSTOMER_PROFILE);
905914
if(customerProfileIds.size() > 0){
906915
transaction.setCustomerProfileId(customerProfileIds.get(0));
907916
}
908917
else{
909918
transaction.setCustomerProfileId("1001");
910919
}
911-
result = (Result<Transaction>) merchant.postTransaction(transaction);
920+
result = (Result<Transaction>) zeroCIMMerchant.postTransaction(transaction);
912921
Assert.assertNotNull(result);
913922
result.printMessages();
914923
Assert.assertTrue(result.isError());

0 commit comments

Comments
 (0)