// 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 * as ospgateway from "oci-ospgateway";
import common = require("oci-common");
// 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.
const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();
(async () => {
try {
// Create a service client
const client = new ospgateway.SubscriptionServiceClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const updateSubscriptionDetails = {
subscription: {
id: "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
subscriptionPlanNumber: "EXAMPLE-subscriptionPlanNumber-Value",
planType: ospgateway.models.Subscription.PlanType.Payg,
timeStart: new Date("Sun Feb 23 07:50:55 UTC 2048"),
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,
isCorporateConversionAllowed: false,
currencyCode: "EXAMPLE-currencyCode-Value",
gsiOrgCode: "EXAMPLE-gsiOrgCode-Value",
languageCode: "EXAMPLE-languageCode-Value",
organizationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-organizationId-Value",
upgradeState: ospgateway.models.Subscription.UpgradeState.Error,
upgradeStateDetails: ospgateway.models.Subscription.UpgradeStateDetails.UpgradeError,
accountType: ospgateway.models.Subscription.AccountType.Corporate,
taxInfo: {
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",
}
,
paymentOptions: [{
paymentMethod: "PAYPAL", emailAddress: "EXAMPLE-emailAddress-Value",
firstName: "EXAMPLE-firstName-Value",
lastName: "EXAMPLE-lastName-Value",
extBillingAgreementId: "ocid1.test.oc1..<unique_ID>EXAMPLE-extBillingAgreementId-Value",
walletInstrumentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-walletInstrumentId-Value",
walletTransactionId: "ocid1.test.oc1..<unique_ID>EXAMPLE-walletTransactionId-Value"
}
],
paymentGateway: {
merchantDefinedData: {
promoType: "EXAMPLE-promoType-Value",
cloudAccountName: "EXAMPLE-cloudAccountName-Value",
}
,
}
,
billingAddress: {
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",
}
,
timePlanUpgrade: new Date("Fri Jul 25 23:28:13 UTC 2042"),
timePersonalToCorporateConv: new Date("Fri Jan 07 19:31:40 UTC 2011"),
}
,
email: "EXAMPLE-email-Value",
}
const updateSubscriptionRequest: ospgateway.requests.UpdateSubscriptionRequest = {
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: "HQ3DP1TMMYGF3QBV7KEC<unique_ID>",
ifMatch: "EXAMPLE-ifMatch-Value",
};
// Send request to the Client.
const updateSubscriptionResponse = await client.updateSubscription(updateSubscriptionRequest);
}
catch (error) {
console.log("updateSubscription Failed with error " + error);
}
})();