UNPKG

square-connect

Version:

JavaScript client library for the Square Connect v2 API

95 lines (76 loc) 3.74 kB
/** * Square Connect API * Client library for accessing the Square Connect APIs * * OpenAPI spec version: 2.0 * Contact: developers@squareup.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.3.0-SNAPSHOT * */ var ApiClient = require('../ApiClient'); var Address = require('./Address'); /** * The CreateCustomerCardRequest model module. * @module model/CreateCustomerCardRequest */ /** * Constructs a new <code>CreateCustomerCardRequest</code>. * Defines the fields that are included in the request body of a request to the CreateCustomerCard endpoint. * @alias module:model/CreateCustomerCardRequest * @class * @param cardNonce {String} A card nonce representing the credit card to link to the customer. Card nonces are generated by the Square Payment Form when customers enter their card information. See [Embedding the payment form](https://developer.squareup.com/docs/payment-form/payment-form-walkthrough) for more information. __NOTE:__ Card nonces generated by digital wallets (e.g., Apple Pay) cannot be used to create a customer card. */ var exports = function(cardNonce) { var _this = this; _this['card_nonce'] = cardNonce; }; /** * Constructs a <code>CreateCustomerCardRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/CreateCustomerCardRequest} obj Optional instance to populate. * @return {module:model/CreateCustomerCardRequest} The populated <code>CreateCustomerCardRequest</code> instance. */ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); if (data.hasOwnProperty('card_nonce')) { obj['card_nonce'] = ApiClient.convertToType(data['card_nonce'], 'String'); } if (data.hasOwnProperty('billing_address')) { obj['billing_address'] = Address.constructFromObject(data['billing_address']); } if (data.hasOwnProperty('cardholder_name')) { obj['cardholder_name'] = ApiClient.convertToType(data['cardholder_name'], 'String'); } if (data.hasOwnProperty('verification_token')) { obj['verification_token'] = ApiClient.convertToType(data['verification_token'], 'String'); } } return obj; } /** * A card nonce representing the credit card to link to the customer. Card nonces are generated by the Square Payment Form when customers enter their card information. See [Embedding the payment form](https://developer.squareup.com/docs/payment-form/payment-form-walkthrough) for more information. __NOTE:__ Card nonces generated by digital wallets (e.g., Apple Pay) cannot be used to create a customer card. * @member {String} card_nonce */ exports.prototype['card_nonce'] = undefined; /** * Address information for the card on file. Only the `postal_code` field is required for payments in the US and Canada. * @member {module:model/Address} billing_address */ exports.prototype['billing_address'] = undefined; /** * The full name printed on the credit card. * @member {String} cardholder_name */ exports.prototype['cardholder_name'] = undefined; /** * An identifying token generated by `SqPaymentForm.verifyBuyer()`. Verification tokens encapsulate customer device information and 3-D Secure challenge results to indicate that Square has verified the buyer identity. * @member {String} verification_token */ exports.prototype['verification_token'] = undefined; module.exports = exports;