card-management-sdk
Version:
The Shell Card Management API is REST-based and employs OAUTH 2.0,Basic and ApiKey authentication. The API endpoints accept JSON-encoded request bodies, return JSON-encoded responses and use standard HTTP response codes. All resources are located in the S
113 lines (93 loc) • 2.74 kB
text/typescript
/**
* Shell Card Management APIsLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import {
CardController,
CardDetailsReq,
CardDetailsResponse,
CardMoveRequest,
CardMoveRes,
} from '../src';
import { testClient } from './testClient.js';
import {
expectHeadersToMatch,
expectMatchingWithOptions,
makeApiCall,
} from './testHelper.js';
describe('CardController', () => {
let controller : CardController;
beforeAll(() => {
controller = new CardController(testClient);
});
it('should Test CardDetails', async () => {
const requestId = '233e4567-e89b-12d3-a456-426614174000';
const body: CardDetailsReq = {
filters: {
colCoCode: 32,
payerNumber: 'CZ00000927',
accountNumber: 'CZ00000927',
pAN: '7002327340223080230',
},
};
const response = await makeApiCall(
() => controller.cardDetails(requestId, body)
);
expect(response.statusCode).toBe(200);
const expectedHeaders = { 'Content-Type': ['application/json', true] };
expectHeadersToMatch(response.headers, expectedHeaders);
const expected: CardDetailsResponse = {
status: 'SUCCESS',
requestId: '233e4567-e89b-12d3-a456-426614174000',
};
expect(response.result).not.toBeNull();
expectMatchingWithOptions(
expected,
response.result,
{ allowExtra: true, isOrdered: false, checkValues: false }
);
});
it('should Test CardMove', async () => {
const requestId = '233e4567-e89b-12d3-a456-426614174000';
const body: CardMoveRequest = {
colCoCode: 32,
payerNumber: 'CZ00000927',
cards: [
{
accountNumber: 'CZ00000927',
cardId: 466251,
}
],
targetAccountNumber: 'CZ00000927',
targetCardGroupId: 3228,
targetNewCardGroupName: 'DEMORE1',
};
const response = await makeApiCall(
() => controller.cardMove(requestId, body)
);
expect(response.statusCode).toBe(200);
const expectedHeaders = { 'Content-Type': ['application/json', true] };
expectHeadersToMatch(response.headers, expectedHeaders);
const expected: CardMoveRes = {
requestId: '233e4567-e89b-12d3-a456-426614174000',
mainReference: 559063,
status: 'SUCCESS',
data: [
{
accountId: '1227',
accountNumber: 'CZ00000927',
cardId: '466251',
pAN: '7002329040232160159',
moveCardReference: '11793',
}
],
};
expect(response.result).not.toBeNull();
expectMatchingWithOptions(
expected,
response.result,
{ allowExtra: true, isOrdered: false, checkValues: false }
);
});
});