cancel
Showing results for 
Search instead for 
Did you mean: 

Cvv issue with CIM Java SDK

If I do not supply the cvv code I'm getting the following error trying to create customer and payment profile:

 

The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' element is invalid - The value '' is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' - The Pattern constraint failed.

 

I'm using the Java 1.8.4 SDK. Wondering if it's an issue with the SDK or I am doing something wrong. Here is what the code looks like:

 

 

        String apiLoginID = ...;
        String transactionKey = ...;
        Merchant merchant = Merchant.createMerchant(environment, apiLoginID, transactionKey);

        CustomerProfile customerProfile = CustomerProfile.createCustomerProfile();
        customerProfile.setMerchantCustomerId(...);
        customerProfile.setEmail(...);
        customerProfile.setDescription(...);

        net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(net.authorize.cim.TransactionType.CREATE_CUSTOMER_PROFILE);
        transaction.setCustomerProfile(customerProfile);

        CreditCard creditCard = CreditCard.createCreditCard();
        creditCard.setCreditCardNumber(...);
        creditCard.setExpirationMonth(...);
        creditCard.setExpirationYear(...);

        net.authorize.data.xml.Payment payment = net.authorize.data.xml.Payment.createPayment(creditCard);

        net.authorize.data.xml.Address address = net.authorize.data.xml.Address.createAddress();
        address.setAddress(...);
        address.setCity(...);
        address.setFirstName(...);
        address.setLastName(...);
        address.setPhoneNumber(...);
        address.setState(...);
        address.setZipPostalCode(...);

        net.authorize.data.cim.PaymentProfile paymentProfile = net.authorize.data.cim.PaymentProfile.createPaymentProfile();
        paymentProfile.setCustomerType(net.authorize.data.xml.CustomerType.INDIVIDUAL);
        paymentProfile.addPayment(payment);
        paymentProfile.setBillTo(address);

        transaction.addPaymentProfile(paymentProfile);
        transaction.setValidationMode(ValidationModeType.TEST_MODE);

        @SuppressWarnings("unchecked")
        net.authorize.cim.Result<net.authorize.cim.Transaction> result = (net.authorize.cim.Result<net.authorize.cim.Transaction>) merchant
                .postTransaction(transaction);

 

Niki

niordanov
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hi Niki,

 

It appears that this is issue has been reported and there is a proposed fix in our github repository. I will talk to our SDK developers about validating this fix and accepting it into our SDK, but for the moment I can only recommend that you apply it manually.

 

View solution in original post

Trevor
Administrator Administrator
Administrator
2 REPLIES 2

Hi Niki,

 

It appears that this is issue has been reported and there is a proposed fix in our github repository. I will talk to our SDK developers about validating this fix and accepting it into our SDK, but for the moment I can only recommend that you apply it manually.

 

Trevor
Administrator Administrator
Administrator

Thanks, Trevor,

 

I'll try the fix.

 

Niki