# 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).

require 'oci'
require 'date'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
osp_gateway_client =
  OCI::OspGateway::SubscriptionServiceClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
authorize_subscription_payment_response =
  osp_gateway_client.authorize_subscription_payment(
    'EXAMPLE-ospHomeRegion-Value',
    'ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value',
    'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
    OCI::OspGateway::Models::AuthorizeSubscriptionPaymentDetails.new(
      subscription:
        OCI::OspGateway::Models::Subscription.new(
          subscription_plan_number: 'EXAMPLE-subscriptionPlanNumber-Value',
          id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value',
          plan_type: 'FREE_TIER',
          time_start: DateTime.parse('2025-06-22T22:49:08.446Z'),
          ship_to_cust_acct_site_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctSiteId-Value',
          ship_to_cust_acct_role_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctRoleId-Value',
          bill_to_cust_account_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-billToCustAccountId-Value',
          is_intent_to_pay: true,
          currency_code: 'EXAMPLE-currencyCode-Value',
          gsi_org_code: 'EXAMPLE-gsiOrgCode-Value',
          language_code: 'EXAMPLE-languageCode-Value',
          organization_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-organizationId-Value',
          upgrade_state: 'UPGRADED',
          upgrade_state_details: 'UPGRADE_ERROR',
          account_type: 'PERSONAL',
          tax_info:
            OCI::OspGateway::Models::TaxInfo.new(
              tax_payer_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-taxPayerId-Value',
              tax_reg_number: 'EXAMPLE-taxRegNumber-Value',
              no_tax_reason_code: 'EXAMPLE-noTaxReasonCode-Value',
              no_tax_reason_code_details:
                'EXAMPLE-noTaxReasonCodeDetails-Value',
              tax_cnpj: 'EXAMPLE-taxCnpj-Value'
            ),
          payment_options: [
            OCI::OspGateway::Models::PaypalPaymentOption.new(
              payment_method: 'PAYPAL',
              wallet_instrument_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-walletInstrumentId-Value',
              wallet_transaction_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-walletTransactionId-Value',
              email_address: 'EXAMPLE-emailAddress-Value',
              first_name: 'EXAMPLE-firstName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              ext_billing_agreement_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-extBillingAgreementId-Value'
            )
          ],
          payment_gateway:
            OCI::OspGateway::Models::PaymentGateway.new(
              merchant_defined_data:
                OCI::OspGateway::Models::MerchantDefinedData.new(
                  promo_type: 'EXAMPLE-promoType-Value',
                  cloud_account_name: 'EXAMPLE-cloudAccountName-Value'
                )
            ),
          billing_address:
            OCI::OspGateway::Models::Address.new(
              address_key: 'EXAMPLE-addressKey-Value',
              line1: 'EXAMPLE-line1-Value',
              line2: 'EXAMPLE-line2-Value',
              line3: 'EXAMPLE-line3-Value',
              line4: 'EXAMPLE-line4-Value',
              street_name: 'EXAMPLE-streetName-Value',
              street_number: 'EXAMPLE-streetNumber-Value',
              city: 'EXAMPLE-city-Value',
              county: 'EXAMPLE-county-Value',
              country: 'EXAMPLE-country-Value',
              province: 'EXAMPLE-province-Value',
              postal_code: 'EXAMPLE-postalCode-Value',
              state: 'EXAMPLE-state-Value',
              email_address: 'EXAMPLE-emailAddress-Value',
              company_name: 'EXAMPLE-companyName-Value',
              first_name: 'EXAMPLE-firstName-Value',
              middle_name: 'EXAMPLE-middleName-Value',
              last_name: 'EXAMPLE-lastName-Value',
              phone_country_code: 'EXAMPLE-phoneCountryCode-Value',
              phone_number: 'EXAMPLE-phoneNumber-Value',
              job_title: 'EXAMPLE-jobTitle-Value',
              department_name: 'EXAMPLE-departmentName-Value',
              internal_number: 'EXAMPLE-internalNumber-Value',
              contributor_class: 'EXAMPLE-contributorClass-Value',
              state_inscription: 'EXAMPLE-stateInscription-Value',
              municipal_inscription: 'EXAMPLE-municipalInscription-Value'
            ),
          time_plan_upgrade: DateTime.parse('2042-03-13T18:13:43.446Z'),
          time_personal_to_corporate_conv:
            DateTime.parse('2048-04-06T18:08:25.655Z')
        ),
      language_code: 'EXAMPLE-languageCode-Value',
      email: 'EXAMPLE-email-Value'
    )
  )

# Get the data from response
puts "#{authorize_subscription_payment_response.data}"