/** This is an automatically generated code sample.
To make this code sample work in your Oracle Cloud tenancy,
please replace the values for any parameters whose current values do not fit
your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
boolean, number, and enum parameters with values not fitting your use case).
*/
import com.oracle.bmc.ConfigFileReader;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.ospgateway.SubscriptionServiceClient;
import com.oracle.bmc.ospgateway.model.*;
import com.oracle.bmc.ospgateway.requests.*;
import com.oracle.bmc.ospgateway.responses.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.UUID;
import java.util.Arrays;
public class UpdateSubscriptionExample {
public static void main(String[] args) throws Exception {
/**
* Create a default authentication provider that uses the DEFAULT
* profile in the configuration file.
* Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
*/
final ConfigFileReader.ConfigFile configFile = ConfigFileReader.parseDefault();
final AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(configFile);
/* Create a service client */
SubscriptionServiceClient client = SubscriptionServiceClient.builder().build(provider);
/* Create a request and dependent object(s). */
UpdateSubscriptionDetails updateSubscriptionDetails = UpdateSubscriptionDetails.builder()
.subscription(Subscription.builder()
.id("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")
.subscriptionPlanNumber("EXAMPLE-subscriptionPlanNumber-Value")
.planType(Subscription.PlanType.Payg)
.timeStart(new Date("Fri Oct 13 08:05:28 UTC 2017"))
.shipToCustAcctSiteId("ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctSiteId-Value")
.shipToCustAcctRoleId("ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctRoleId-Value")
.billToCustAccountId("ocid1.test.oc1..<unique_ID>EXAMPLE-billToCustAccountId-Value")
.isIntentToPay(false)
.currencyCode("EXAMPLE-currencyCode-Value")
.gsiOrgCode("EXAMPLE-gsiOrgCode-Value")
.languageCode("EXAMPLE-languageCode-Value")
.organizationId("ocid1.test.oc1..<unique_ID>EXAMPLE-organizationId-Value")
.upgradeState(Subscription.UpgradeState.Error)
.upgradeStateDetails(Subscription.UpgradeStateDetails.TaxError)
.accountType(Subscription.AccountType.CorporateSubmitted)
.taxInfo(TaxInfo.builder()
.taxPayerId("ocid1.test.oc1..<unique_ID>EXAMPLE-taxPayerId-Value")
.taxRegNumber("EXAMPLE-taxRegNumber-Value")
.noTaxReasonCode("EXAMPLE-noTaxReasonCode-Value")
.noTaxReasonCodeDetails("EXAMPLE-noTaxReasonCodeDetails-Value")
.taxCnpj("EXAMPLE-taxCnpj-Value")
.giro("EXAMPLE-giro-Value").build())
.paymentOptions(new ArrayList<>(Arrays.asList(CreditCardPaymentOption.builder()
.creditCardType(CreditCardType.Visa)
.lastDigits("EXAMPLE-lastDigits-Value")
.nameOnCard("EXAMPLE-nameOnCard-Value")
.timeExpiration(new Date("Fri Jul 27 18:42:42 UTC 2035"))
.walletInstrumentId("ocid1.test.oc1..<unique_ID>EXAMPLE-walletInstrumentId-Value")
.walletTransactionId("ocid1.test.oc1..<unique_ID>EXAMPLE-walletTransactionId-Value").build())))
.paymentGateway(PaymentGateway.builder()
.merchantDefinedData(MerchantDefinedData.builder()
.promoType("EXAMPLE-promoType-Value")
.cloudAccountName("EXAMPLE-cloudAccountName-Value").build()).build())
.billingAddress(Address.builder()
.addressKey("EXAMPLE-addressKey-Value")
.line1("EXAMPLE-line1-Value")
.line2("EXAMPLE-line2-Value")
.line3("EXAMPLE-line3-Value")
.line4("EXAMPLE-line4-Value")
.streetName("EXAMPLE-streetName-Value")
.streetNumber("EXAMPLE-streetNumber-Value")
.city("EXAMPLE-city-Value")
.county("EXAMPLE-county-Value")
.country("EXAMPLE-country-Value")
.province("EXAMPLE-province-Value")
.postalCode("EXAMPLE-postalCode-Value")
.state("EXAMPLE-state-Value")
.emailAddress("EXAMPLE-emailAddress-Value")
.companyName("EXAMPLE-companyName-Value")
.firstName("EXAMPLE-firstName-Value")
.middleName("EXAMPLE-middleName-Value")
.lastName("EXAMPLE-lastName-Value")
.phoneCountryCode("EXAMPLE-phoneCountryCode-Value")
.phoneNumber("EXAMPLE-phoneNumber-Value")
.jobTitle("EXAMPLE-jobTitle-Value")
.departmentName("EXAMPLE-departmentName-Value")
.internalNumber("EXAMPLE-internalNumber-Value")
.contributorClass("EXAMPLE-contributorClass-Value")
.stateInscription("EXAMPLE-stateInscription-Value")
.municipalInscription("EXAMPLE-municipalInscription-Value").build())
.timePlanUpgrade(new Date("Sun Jun 08 13:14:37 UTC 2014"))
.timePersonalToCorporateConv(new Date("Tue Apr 25 08:56:36 UTC 2034")).build())
.email("EXAMPLE-email-Value").build();
UpdateSubscriptionRequest updateSubscriptionRequest = UpdateSubscriptionRequest.builder()
.subscriptionId("ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value")
.ospHomeRegion("EXAMPLE-ospHomeRegion-Value")
.compartmentId("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")
.updateSubscriptionDetails(updateSubscriptionDetails)
.opcRequestId("SCJE32OVPYWWFMVKH1FX<unique_ID>")
.ifMatch("EXAMPLE-ifMatch-Value").build();
/* Send request to the Client */
UpdateSubscriptionResponse response = client.updateSubscription(updateSubscriptionRequest);
}
}