UNPKG

square-connect

Version:

JavaScript client library for the Square Connect v2 API

86 lines (73 loc) 3.56 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 RegisterDomainRequest = require('../model/RegisterDomainRequest'); var RegisterDomainResponse = require('../model/RegisterDomainResponse'); /** * ApplePay service. * @module api/ApplePayApi */ /** * Constructs a new ApplePayApi. * @alias module:api/ApplePayApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ module.exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * RegisterDomain * Activates a domain for use with Web Apple Pay and Square. A validation will be performed on this domain by Apple to ensure is it properly set up as an Apple Pay enabled domain. This endpoint provides an easy way for platform developers to bulk activate Web Apple Pay with Square for merchants using their platform. To learn more about Apple Pay on Web see the Apple Pay section in the [Square Payment Form Walkthrough](/docs/payment-form/payment-form-walkthrough). * @param {module:model/RegisterDomainRequest} body An object containing the fields to POST for the request. See the corresponding object definition for field details. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/RegisterDomainResponse} and HTTP response */ this.registerDomainWithHttpInfo = function(body) { var postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { throw new Error("Missing the required parameter 'body' when calling registerDomain"); } var pathParams = { }; var queryParams = { }; var headerParams = { }; headerParams['Square-Version'] = '2020-12-16'; var formParams = { }; var authNames = ['oauth2']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = RegisterDomainResponse; return this.apiClient.callApi( '/v2/apple-pay/domains', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * RegisterDomain * Activates a domain for use with Web Apple Pay and Square. A validation will be performed on this domain by Apple to ensure is it properly set up as an Apple Pay enabled domain. This endpoint provides an easy way for platform developers to bulk activate Web Apple Pay with Square for merchants using their platform. To learn more about Apple Pay on Web see the Apple Pay section in the [Square Payment Form Walkthrough](/docs/payment-form/payment-form-walkthrough). * @param {module:model/RegisterDomainRequest} body An object containing the fields to POST for the request. See the corresponding object definition for field details. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/RegisterDomainResponse} */ this.registerDomain = function(body) { return this.registerDomainWithHttpInfo(body) .then(function(response_and_data) { return response_and_data.data; }); } };