@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
184 lines • 6.47 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createUnifiedResource = createUnifiedResource;
exports.createUnifiedDataResource = createUnifiedDataResource;
const schemas_1 = require("../schemas");
/**
* Creates the unified resource methods
* OpenAPI Path: /api/unified → unified.*
* @description Unified payment operations through Element Express
*/
function createUnifiedResource(executeRequest) {
return {
/**
* Transaction Setup Operations
*/
transactionSetup: {
/**
* Creates a new payment transaction session with customer and account information
* @fullPath api.payments.unified.transactionSetup.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.transactionSetup.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/transaction-setup',
paramsSchema: schemas_1.TransactionSetupParamsSchema,
responseSchema: schemas_1.TransactionSetupResponseSchema,
}, params);
},
},
/**
* Account Query Operations
*/
accountQuery: {
/**
* Retrieves payment account information using a transaction setup ID
* @fullPath api.payments.unified.accountQuery.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.accountQuery.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/account-query',
paramsSchema: schemas_1.AccountQueryParamsSchema,
responseSchema: schemas_1.AccountQueryResponseSchema,
}, params);
},
},
/**
* Billing Update Operations
*/
billingUpdate: {
/**
* Updates billing information for an existing transaction
* @fullPath api.payments.unified.billingUpdate.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.billingUpdate.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/billing-update',
paramsSchema: schemas_1.BillingUpdateParamsSchema,
responseSchema: schemas_1.BillingUpdateResponseSchema,
}, params);
},
},
/**
* Card Info Operations
*/
cardInfo: {
/**
* Retrieves formatted card information for a transaction
* @fullPath api.payments.unified.cardInfo.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.cardInfo.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/card-info',
paramsSchema: schemas_1.CardInfoParamsSchema,
responseSchema: schemas_1.CardInfoResponseSchema,
}, params);
},
},
/**
* Surcharge Operations
*/
surcharge: {
/**
* Calculates payment processing surcharges based on location and payment details
* @fullPath api.payments.unified.surcharge.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.surcharge.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/surcharge',
paramsSchema: schemas_1.SurchargeParamsSchema,
responseSchema: schemas_1.SurchargeResponseSchema,
}, params);
},
},
/**
* Validate Operations
*/
validate: {
/**
* Validates an existing transaction setup
* @fullPath api.payments.unified.validate.get
* @service payments
* @domain payment-processing
* @dataMethod unifiedData.validate.get
* @discoverable true
*/
get: async (params) => {
return executeRequest({
method: 'GET',
path: '/unified/validate',
paramsSchema: schemas_1.ValidateParamsSchema,
responseSchema: schemas_1.ValidateResponseSchema,
}, params);
},
},
};
}
/**
* Creates the unifiedData resource methods (data-only versions)
*/
function createUnifiedDataResource(unified) {
return {
transactionSetup: {
get: async (params) => {
const response = await unified.transactionSetup.get(params);
return response.data;
},
},
accountQuery: {
get: async (params) => {
const response = await unified.accountQuery.get(params);
return response.data;
},
},
billingUpdate: {
get: async (params) => {
const response = await unified.billingUpdate.get(params);
return response.data;
},
},
cardInfo: {
get: async (params) => {
const response = await unified.cardInfo.get(params);
return response.data;
},
},
surcharge: {
get: async (params) => {
const response = await unified.surcharge.get(params);
return response.data;
},
},
validate: {
get: async (params) => {
const response = await unified.validate.get(params);
return response.data;
},
},
};
}
//# sourceMappingURL=unified.js.map