UNPKG

square-connect

Version:

JavaScript client library for the Square Connect v2 API

157 lines (130 loc) 4.76 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 Card model module. * @module model/Card */ /** * Constructs a new <code>Card</code>. * Represents the payment details of a card to be used for payments. These details are determined by the &#x60;card_nonce&#x60; generated by &#x60;SqPaymentForm&#x60;. * @alias module:model/Card * @class */ var exports = function() { var _this = this; }; /** * Constructs a <code>Card</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/Card} obj Optional instance to populate. * @return {module:model/Card} The populated <code>Card</code> instance. */ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'String'); } if (data.hasOwnProperty('card_brand')) { obj['card_brand'] = ApiClient.convertToType(data['card_brand'], 'String'); } if (data.hasOwnProperty('last_4')) { obj['last_4'] = ApiClient.convertToType(data['last_4'], 'String'); } if (data.hasOwnProperty('exp_month')) { obj['exp_month'] = ApiClient.convertToType(data['exp_month'], 'Number'); } if (data.hasOwnProperty('exp_year')) { obj['exp_year'] = ApiClient.convertToType(data['exp_year'], 'Number'); } if (data.hasOwnProperty('cardholder_name')) { obj['cardholder_name'] = ApiClient.convertToType(data['cardholder_name'], 'String'); } if (data.hasOwnProperty('billing_address')) { obj['billing_address'] = Address.constructFromObject(data['billing_address']); } if (data.hasOwnProperty('fingerprint')) { obj['fingerprint'] = ApiClient.convertToType(data['fingerprint'], 'String'); } if (data.hasOwnProperty('card_type')) { obj['card_type'] = ApiClient.convertToType(data['card_type'], 'String'); } if (data.hasOwnProperty('prepaid_type')) { obj['prepaid_type'] = ApiClient.convertToType(data['prepaid_type'], 'String'); } if (data.hasOwnProperty('bin')) { obj['bin'] = ApiClient.convertToType(data['bin'], 'String'); } } return obj; } /** * Unique ID for this card. Generated by Square. * @member {String} id */ exports.prototype['id'] = undefined; /** * The card's brand. See [CardBrand](#type-cardbrand) for possible values * @member {String} card_brand */ exports.prototype['card_brand'] = undefined; /** * The last 4 digits of the card number. * @member {String} last_4 */ exports.prototype['last_4'] = undefined; /** * The expiration month of the associated card as an integer between 1 and 12. * @member {Number} exp_month */ exports.prototype['exp_month'] = undefined; /** * The four-digit year of the card's expiration date. * @member {Number} exp_year */ exports.prototype['exp_year'] = undefined; /** * The name of the cardholder. * @member {String} cardholder_name */ exports.prototype['cardholder_name'] = undefined; /** * The billing address for this card. * @member {module:model/Address} billing_address */ exports.prototype['billing_address'] = undefined; /** * __Not currently set.__ Intended as a Square-assigned identifier, based on the card number, to identify the card across multiple locations within a single application. * @member {String} fingerprint */ exports.prototype['fingerprint'] = undefined; /** * The type of the card. The Card object includes this field only in response to Payments API calls. See [CardType](#type-cardtype) for possible values * @member {String} card_type */ exports.prototype['card_type'] = undefined; /** * Indicates whether the Card is prepaid or not. The Card object includes this field only in response to Payments API calls. See [CardPrepaidType](#type-cardprepaidtype) for possible values * @member {String} prepaid_type */ exports.prototype['prepaid_type'] = undefined; /** * The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API returns this field. * @member {String} bin */ exports.prototype['bin'] = undefined; module.exports = exports;