<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Environment not set. Set environment using setter or use overloaded method to pass appropriate envir in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Environment-not-set-Set-environment-using-setter-or-use/m-p/83805#M52851</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;Anyone having this issue?&lt;BR /&gt;I'm just running the Java example code the perform an authorization and getting a null response.&lt;BR /&gt;Debugging it I see that controller object has no properly set the environment. The exact message is:&lt;BR /&gt;"Environment not set. Set environment using setter or use overloaded method to pass appropriate environment". What i did is, added anet-java-sdk-1.8.6.jar into my project lib and copied the below code into my java test program.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//Common code to set for all requests&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ApiOperationBase&lt;/SPAN&gt;.&lt;SPAN&gt;setEnvironment&lt;/SPAN&gt;(&lt;SPAN&gt;Environment&lt;/SPAN&gt;.&lt;SPAN&gt;SANDBOX&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;       &lt;SPAN&gt;MerchantAuthenticationType merchantAuthenticationType  &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;MerchantAuthenticationType() ;&lt;BR /&gt;       &lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;.setName(apiLoginId);&lt;BR /&gt;       &lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;.setTransactionKey(transactionKey);&lt;BR /&gt;       &lt;SPAN&gt;ApiOperationBase&lt;/SPAN&gt;.&lt;SPAN&gt;setMerchantAuthentication&lt;/SPAN&gt;(&lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;BR /&gt;   &lt;SPAN&gt;String customerprofileId &lt;/SPAN&gt;= &lt;SPAN&gt;"36374423" &lt;/SPAN&gt;;&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreditCardType creditCard &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreditCardType();&lt;BR /&gt;   &lt;SPAN&gt;creditCard&lt;/SPAN&gt;.setCardNumber(&lt;SPAN&gt;"4111111111111111"&lt;/SPAN&gt;);&lt;BR /&gt;    &lt;SPAN&gt;creditCard&lt;/SPAN&gt;.setExpirationDate(&lt;SPAN&gt;"0616"&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;PaymentType paymentType &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;PaymentType();&lt;BR /&gt;   &lt;SPAN&gt;paymentType&lt;/SPAN&gt;.setCreditCard(&lt;SPAN&gt;creditCard&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;TransactionRequestType requestInternal &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;TransactionRequestType();&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setTransactionType(&lt;SPAN&gt;"authOnlyTransaction"&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setPayment(&lt;SPAN&gt;paymentType&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setAmount(&lt;SPAN&gt;new &lt;/SPAN&gt;BigDecimal(&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;currentTimeMillis&lt;/SPAN&gt;() % &lt;SPAN&gt;100&lt;/SPAN&gt;));&lt;BR /&gt;   &lt;BR /&gt;   &lt;SPAN&gt;CustomerDataType customer &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CustomerDataType();&lt;BR /&gt;   &lt;SPAN&gt;customer&lt;/SPAN&gt;.setEmail(&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;currentTimeMillis&lt;/SPAN&gt;()+&lt;SPAN&gt;"@b.bla"&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setCustomer(&lt;SPAN&gt;customer&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionRequest request &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateTransactionRequest();&lt;BR /&gt;   &lt;SPAN&gt;request&lt;/SPAN&gt;.setTransactionRequest(&lt;SPAN&gt;requestInternal&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionController controller &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateTransactionController(&lt;SPAN&gt;request&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;controller&lt;/SPAN&gt;.execute();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionResponse response &lt;/SPAN&gt;= &lt;SPAN&gt;controller&lt;/SPAN&gt;.getApiResponse();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileFromTransactionRequest transaction_request &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerProfileFromTransactionRequest();&lt;BR /&gt;   &lt;SPAN&gt;transaction_request&lt;/SPAN&gt;.setTransId(&lt;SPAN&gt;response&lt;/SPAN&gt;.getTransactionResponse().getTransId());&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileFromTransactionController createProfileController &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerProfileFromTransactionController(&lt;SPAN&gt;transaction_request&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;createProfileController&lt;/SPAN&gt;.execute();&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileResponse customer_response &lt;/SPAN&gt;= &lt;SPAN&gt;createProfileController&lt;/SPAN&gt;.getApiResponse();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;customer_response &lt;/SPAN&gt;!= &lt;SPAN&gt;null&lt;/SPAN&gt;) {&lt;BR /&gt;      &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;transaction_request&lt;/SPAN&gt;.getTransId());&lt;BR /&gt;   }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiniouer_0-1660715752311.png" style="width: 400px;"&gt;&lt;img src="https://community.developer.cybersource.com/t5/image/serverpage/image-id/2346iD0195D933912C9B5/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="xiniouer_0-1660715752311.png" alt="xiniouer_0-1660715752311.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2022 05:57:53 GMT</pubDate>
    <dc:creator>xiniouer</dc:creator>
    <dc:date>2022-08-17T05:57:53Z</dc:date>
    <item>
      <title>Environment not set. Set environment using setter or use overloaded method to pass appropriate envir</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Environment-not-set-Set-environment-using-setter-or-use/m-p/83805#M52851</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;Anyone having this issue?&lt;BR /&gt;I'm just running the Java example code the perform an authorization and getting a null response.&lt;BR /&gt;Debugging it I see that controller object has no properly set the environment. The exact message is:&lt;BR /&gt;"Environment not set. Set environment using setter or use overloaded method to pass appropriate environment". What i did is, added anet-java-sdk-1.8.6.jar into my project lib and copied the below code into my java test program.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//Common code to set for all requests&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ApiOperationBase&lt;/SPAN&gt;.&lt;SPAN&gt;setEnvironment&lt;/SPAN&gt;(&lt;SPAN&gt;Environment&lt;/SPAN&gt;.&lt;SPAN&gt;SANDBOX&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;       &lt;SPAN&gt;MerchantAuthenticationType merchantAuthenticationType  &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;MerchantAuthenticationType() ;&lt;BR /&gt;       &lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;.setName(apiLoginId);&lt;BR /&gt;       &lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;.setTransactionKey(transactionKey);&lt;BR /&gt;       &lt;SPAN&gt;ApiOperationBase&lt;/SPAN&gt;.&lt;SPAN&gt;setMerchantAuthentication&lt;/SPAN&gt;(&lt;SPAN&gt;merchantAuthenticationType&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;BR /&gt;   &lt;SPAN&gt;String customerprofileId &lt;/SPAN&gt;= &lt;SPAN&gt;"36374423" &lt;/SPAN&gt;;&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreditCardType creditCard &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreditCardType();&lt;BR /&gt;   &lt;SPAN&gt;creditCard&lt;/SPAN&gt;.setCardNumber(&lt;SPAN&gt;"4111111111111111"&lt;/SPAN&gt;);&lt;BR /&gt;    &lt;SPAN&gt;creditCard&lt;/SPAN&gt;.setExpirationDate(&lt;SPAN&gt;"0616"&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;PaymentType paymentType &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;PaymentType();&lt;BR /&gt;   &lt;SPAN&gt;paymentType&lt;/SPAN&gt;.setCreditCard(&lt;SPAN&gt;creditCard&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;TransactionRequestType requestInternal &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;TransactionRequestType();&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setTransactionType(&lt;SPAN&gt;"authOnlyTransaction"&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setPayment(&lt;SPAN&gt;paymentType&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setAmount(&lt;SPAN&gt;new &lt;/SPAN&gt;BigDecimal(&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;currentTimeMillis&lt;/SPAN&gt;() % &lt;SPAN&gt;100&lt;/SPAN&gt;));&lt;BR /&gt;   &lt;BR /&gt;   &lt;SPAN&gt;CustomerDataType customer &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CustomerDataType();&lt;BR /&gt;   &lt;SPAN&gt;customer&lt;/SPAN&gt;.setEmail(&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;currentTimeMillis&lt;/SPAN&gt;()+&lt;SPAN&gt;"@b.bla"&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;requestInternal&lt;/SPAN&gt;.setCustomer(&lt;SPAN&gt;customer&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionRequest request &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateTransactionRequest();&lt;BR /&gt;   &lt;SPAN&gt;request&lt;/SPAN&gt;.setTransactionRequest(&lt;SPAN&gt;requestInternal&lt;/SPAN&gt;);&lt;BR /&gt;         &lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionController controller &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateTransactionController(&lt;SPAN&gt;request&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;controller&lt;/SPAN&gt;.execute();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreateTransactionResponse response &lt;/SPAN&gt;= &lt;SPAN&gt;controller&lt;/SPAN&gt;.getApiResponse();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileFromTransactionRequest transaction_request &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerProfileFromTransactionRequest();&lt;BR /&gt;   &lt;SPAN&gt;transaction_request&lt;/SPAN&gt;.setTransId(&lt;SPAN&gt;response&lt;/SPAN&gt;.getTransactionResponse().getTransId());&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileFromTransactionController createProfileController &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;CreateCustomerProfileFromTransactionController(&lt;SPAN&gt;transaction_request&lt;/SPAN&gt;);&lt;BR /&gt;   &lt;SPAN&gt;createProfileController&lt;/SPAN&gt;.execute();&lt;BR /&gt;   &lt;SPAN&gt;CreateCustomerProfileResponse customer_response &lt;/SPAN&gt;= &lt;SPAN&gt;createProfileController&lt;/SPAN&gt;.getApiResponse();&lt;BR /&gt;&lt;BR /&gt;   &lt;SPAN&gt;if&lt;/SPAN&gt;(&lt;SPAN&gt;customer_response &lt;/SPAN&gt;!= &lt;SPAN&gt;null&lt;/SPAN&gt;) {&lt;BR /&gt;      &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;transaction_request&lt;/SPAN&gt;.getTransId());&lt;BR /&gt;   }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xiniouer_0-1660715752311.png" style="width: 400px;"&gt;&lt;img src="https://community.developer.cybersource.com/t5/image/serverpage/image-id/2346iD0195D933912C9B5/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="xiniouer_0-1660715752311.png" alt="xiniouer_0-1660715752311.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 05:57:53 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Environment-not-set-Set-environment-using-setter-or-use/m-p/83805#M52851</guid>
      <dc:creator>xiniouer</dc:creator>
      <dc:date>2022-08-17T05:57:53Z</dc:date>
    </item>
  </channel>
</rss>

