pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
129 lines • 5.57 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShippingRate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* With this resource, you can create a shipping rate - [Stripe API shipping rate documentation](https://stripe.com/docs/api/shipping_rates).
*
* Shipping rates let you display various shipping options—like standard, express, and overnight—with more accurate delivery estimates.
* Charge your customer for shipping using different Stripe products, some of which require coding.
*
* > Removal of the shipping rate isn't supported through the Stripe SDK. The best practice, which this provider follows,
* is to archive the shipping rate by marking it as inactive on destroy, which indicates that the shipping rate is no longer
* available.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // shipping rate with delivery estimate
* const shippingRate = new stripe.ShippingRate("shippingRate", {
* deliveryEstimates: [{
* maximum: {
* unit: "day",
* value: 4,
* },
* minimum: {
* unit: "hour",
* value: 24,
* },
* }],
* displayName: "shipping rate",
* fixedAmount: {
* amount: 1000,
* currency: "aud",
* },
* });
* // shipping rate with currency options
* // !!! Currency options have to be sorted alphabetically
* // !!! by the currency field
* const shipping = new stripe.ShippingRate("shipping", {
* displayName: "shipping rate",
* fixedAmount: {
* amount: 1000,
* currency: "aud",
* currencyOptions: [
* {
* amount: 350,
* currency: "eur",
* },
* {
* amount: 500,
* currency: "usd",
* },
* ],
* },
* });
* ```
* <!--End PulumiCodeChooser -->
*/
class ShippingRate extends pulumi.CustomResource {
/**
* Get an existing ShippingRate resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new ShippingRate(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ShippingRate. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ShippingRate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["active"] = state ? state.active : undefined;
resourceInputs["deliveryEstimates"] = state ? state.deliveryEstimates : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["fixedAmount"] = state ? state.fixedAmount : undefined;
resourceInputs["livemode"] = state ? state.livemode : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["taxBehavior"] = state ? state.taxBehavior : undefined;
resourceInputs["taxCode"] = state ? state.taxCode : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.displayName === undefined) && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if ((!args || args.fixedAmount === undefined) && !opts.urn) {
throw new Error("Missing required property 'fixedAmount'");
}
resourceInputs["active"] = args ? args.active : undefined;
resourceInputs["deliveryEstimates"] = args ? args.deliveryEstimates : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["fixedAmount"] = args ? args.fixedAmount : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["taxBehavior"] = args ? args.taxBehavior : undefined;
resourceInputs["taxCode"] = args ? args.taxCode : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["livemode"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ShippingRate.__pulumiType, name, resourceInputs, opts);
}
}
exports.ShippingRate = ShippingRate;
/** @internal */
ShippingRate.__pulumiType = 'stripe:index/shippingRate:ShippingRate';
//# sourceMappingURL=shippingRate.js.map