// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.OspgatewayService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Ospgateway
{
public class AuthorizeSubscriptionPaymentExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var authorizeSubscriptionPaymentDetails = new Oci.OspgatewayService.Models.AuthorizeSubscriptionPaymentDetails
{
Subscription = new Oci.OspgatewayService.Models.Subscription
{
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
SubscriptionPlanNumber = "EXAMPLE-subscriptionPlanNumber-Value",
PlanType = Oci.OspgatewayService.Models.Subscription.PlanTypeEnum.FreeTier,
TimeStart = DateTime.Parse("07/04/2032 06:34:53"),
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 = true,
CurrencyCode = "EXAMPLE-currencyCode-Value",
GsiOrgCode = "EXAMPLE-gsiOrgCode-Value",
LanguageCode = "EXAMPLE-languageCode-Value",
OrganizationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-organizationId-Value",
UpgradeState = Oci.OspgatewayService.Models.Subscription.UpgradeStateEnum.Upgraded,
UpgradeStateDetails = Oci.OspgatewayService.Models.Subscription.UpgradeStateDetailsEnum.UpgradeError,
AccountType = Oci.OspgatewayService.Models.Subscription.AccountTypeEnum.CorporateSubmitted,
TaxInfo = new Oci.OspgatewayService.Models.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 = new List<Oci.OspgatewayService.Models.PaymentOption>
{
new Oci.OspgatewayService.Models.CreditCardPaymentOption
{
CreditCardType = Oci.OspgatewayService.Models.CreditCardType.Elo,
LastDigits = "EXAMPLE-lastDigits-Value",
NameOnCard = "EXAMPLE-nameOnCard-Value",
TimeExpiration = DateTime.Parse("08/28/2035 11:24:09"),
WalletInstrumentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-walletInstrumentId-Value",
WalletTransactionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-walletTransactionId-Value"
}
},
PaymentGateway = new Oci.OspgatewayService.Models.PaymentGateway
{
MerchantDefinedData = new Oci.OspgatewayService.Models.MerchantDefinedData
{
PromoType = "EXAMPLE-promoType-Value",
CloudAccountName = "EXAMPLE-cloudAccountName-Value"
}
},
BillingAddress = new Oci.OspgatewayService.Models.Address
{
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 = DateTime.Parse("04/01/2032 12:05:08"),
TimePersonalToCorporateConv = DateTime.Parse("09/06/2037 08:55:38")
},
LanguageCode = "EXAMPLE-languageCode-Value",
Email = "EXAMPLE-email-Value"
};
var authorizeSubscriptionPaymentRequest = new Oci.OspgatewayService.Requests.AuthorizeSubscriptionPaymentRequest
{
OspHomeRegion = "EXAMPLE-ospHomeRegion-Value",
SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
AuthorizeSubscriptionPaymentDetails = authorizeSubscriptionPaymentDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "H1FXTGQ1FZGRGUCPXF0L<unique_ID>"
};
// 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.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new SubscriptionServiceClient(provider, new ClientConfiguration()))
{
var response = await client.AuthorizeSubscriptionPayment(authorizeSubscriptionPaymentRequest);
// Retrieve value from the response.
var headerIdValue = response.AuthorizeSubscriptionPaymentReceipt.HeaderId;
}
}
catch (Exception e)
{
Console.WriteLine($"AuthorizeSubscriptionPayment Failed with {e.Message}");
throw e;
}
}
}
}