pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
132 lines • 6.28 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.Card = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as stripe from "pulumi-stripe";
*
* // card for the customer
* const cardCard = new stripe.Card("cardCard", {
* customer: stripe_customer.customer.id,
* number: "4242424242424242",
* cvc: 123,
* expMonth: 8,
* expYear: 2030,
* });
* // card for the customer with address
* const cardIndex_cardCard = new stripe.Card("cardIndex/cardCard", {
* customer: stripe_customer.customer.id,
* number: "4242424242424242",
* cvc: 123,
* expMonth: 8,
* expYear: 2030,
* address: {
* line1: "1 The Best Street",
* line2: "Apartment 401",
* city: "Sydney",
* state: "NSW",
* zip: "2000",
* country: "Australia",
* },
* });
* ```
* <!--End PulumiCodeChooser -->
*/
class Card extends pulumi.CustomResource {
/**
* Get an existing Card 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 Card(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Card. 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'] === Card.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state ? state.address : undefined;
resourceInputs["addressLine1Check"] = state ? state.addressLine1Check : undefined;
resourceInputs["addressZipCheck"] = state ? state.addressZipCheck : undefined;
resourceInputs["availablePayoutMethods"] = state ? state.availablePayoutMethods : undefined;
resourceInputs["brand"] = state ? state.brand : undefined;
resourceInputs["country"] = state ? state.country : undefined;
resourceInputs["customer"] = state ? state.customer : undefined;
resourceInputs["cvc"] = state ? state.cvc : undefined;
resourceInputs["cvcCheck"] = state ? state.cvcCheck : undefined;
resourceInputs["expMonth"] = state ? state.expMonth : undefined;
resourceInputs["expYear"] = state ? state.expYear : undefined;
resourceInputs["fingerprint"] = state ? state.fingerprint : undefined;
resourceInputs["funding"] = state ? state.funding : undefined;
resourceInputs["last4"] = state ? state.last4 : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["number"] = state ? state.number : undefined;
resourceInputs["tokenizationMethod"] = state ? state.tokenizationMethod : undefined;
}
else {
const args = argsOrState;
if ((!args || args.customer === undefined) && !opts.urn) {
throw new Error("Missing required property 'customer'");
}
if ((!args || args.expMonth === undefined) && !opts.urn) {
throw new Error("Missing required property 'expMonth'");
}
if ((!args || args.expYear === undefined) && !opts.urn) {
throw new Error("Missing required property 'expYear'");
}
if ((!args || args.number === undefined) && !opts.urn) {
throw new Error("Missing required property 'number'");
}
resourceInputs["address"] = args ? args.address : undefined;
resourceInputs["customer"] = args ? args.customer : undefined;
resourceInputs["cvc"] = (args === null || args === void 0 ? void 0 : args.cvc) ? pulumi.secret(args.cvc) : undefined;
resourceInputs["expMonth"] = args ? args.expMonth : undefined;
resourceInputs["expYear"] = args ? args.expYear : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["number"] = (args === null || args === void 0 ? void 0 : args.number) ? pulumi.secret(args.number) : undefined;
resourceInputs["addressLine1Check"] = undefined /*out*/;
resourceInputs["addressZipCheck"] = undefined /*out*/;
resourceInputs["availablePayoutMethods"] = undefined /*out*/;
resourceInputs["brand"] = undefined /*out*/;
resourceInputs["country"] = undefined /*out*/;
resourceInputs["cvcCheck"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["funding"] = undefined /*out*/;
resourceInputs["last4"] = undefined /*out*/;
resourceInputs["tokenizationMethod"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["cvc", "number"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Card.__pulumiType, name, resourceInputs, opts);
}
}
exports.Card = Card;
/** @internal */
Card.__pulumiType = 'stripe:index/card:Card';
//# sourceMappingURL=card.js.map