# pip-clients-creditcards-node

> Node.js client sdk for pip-services-creditcards microservice

Latest version **1.0.0** (published 2020-01-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install pip-clients-creditcards-node
pnpm add pip-clients-creditcards-node
yarn add pip-clients-creditcards-node
bun add pip-clients-creditcards-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-01-14 |
| First published | 2020-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=0.6.14 |
| Dependencies | 4 |
| Unpacked size | 53 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Conceptual Vision Consulting LLC |
| Maintainers | pipdeveloper |
| Keywords | pip.services, credit_cards, microservice, client, sdk |

## Links

- npm: https://www.npmjs.com/package/pip-clients-creditcards-node
- Repository: https://github.com/pip-services-ecommerce/pip-clients-creditcards-node
- Homepage: https://github.com/pip-services-ecommerce/pip-clients-creditcards-node#readme
- Issues: https://github.com/pip-services-ecommerce/pip-clients-creditcards-node/issues
- npm.io page: https://npm.io/package/pip-clients-creditcards-node

## Dependencies (4)

- [pip-services3-aws-node](https://npm.io/package/pip-services3-aws-node.md) ^3.0.0
- [pip-services3-rpc-node](https://npm.io/package/pip-services3-rpc-node.md) ^3.0.0
- [pip-services3-commons-node](https://npm.io/package/pip-services3-commons-node.md) ^3.0.0
- [pip-services3-components-node](https://npm.io/package/pip-services3-components-node.md) ^3.0.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-01-14

## README

# <img src="https://github.com/pip-services/pip-services/raw/master/design/Logo.png" alt="Pip.Services Logo" style="max-width:30%"> <br/> Credit Cards Microservice Client SDK for Node.js

This is a Node.js client SDK for [pip-services-creditcards](https://github.com/pip-services/pip-services-creditcards) microservice.
It provides an easy to use abstraction over communication protocols:

* Direct client
* HTTP client
* Seneca client (see http://www.senecajs.org)
* AWS Lambda client (see https://aws.amazon.com/lambda)

<a name="links"></a> Quick Links:

* [Development Guide](doc/Development.md)
* [API Version 1](doc/NodeClientApiV1.md)

## Install

Add dependency to the client SDK into **package.json** file of your project
```javascript
{
    ...
    "dependencies": {
        ....
        "pip-clients-creditcards-node": "^2.0.*",
        ...
    }
}
```

Then install the dependency using **npm** tool
```bash
# Install new dependencies
npm install

# Update already installed dependencies
npm update
```

## Use

Inside your code get the reference to the client SDK
```javascript
var sdk = new require('pip-clients-creditcards-node');
```

Define client configuration parameters that match configuration of the microservice external API
```javascript
// Client configuration
var config = {
    connection: {
        protocol: 'http',
        host: 'localhost', 
        port: 8080
    }
};
```

Instantiate the client and open connection to the microservice
```javascript
// Create the client instance
var client = sdk.CreditCardsHttpClientV1(config);

// Connect to the microservice
client.open(null, function(err) {
    if (err) {
        console.error('Connection to the microservice failed');
        console.error(err);
        return;
    }
    
    // Work with the microservice
    ...
});
```

Now the client is ready to perform operations
```javascript
// Create a new credit_card
var credit_card = {
    customer_id: '1',
    type: 'visa',
    number: '1111111111111111',
    expire_month: 1,
    expire_year: 2021,
    first_name: 'Bill',
    last_name: 'Gates',
    billing_address: {
        line1: '2345 Swan Rd',
        city: 'Tucson',
        zip: '85710',
        country_code: 'US'
    },
    cvc: '213',
    name: 'Test Card 1',
    saved: true,
    default: true,
    state: 'ok'
};

client.createCreditCard(
    null,
    credit_card,
    function (err, credit_card) {
        ...
    }
);
```

```javascript
// Get the list of credit_cards on 'time management' topic
client.getCreditCards(
    null,
    {
        customer_id: '1',
        state: 'ok'
    },
    {
        total: true,
        skip: 0,
        take: 10
    },
    function(err, page) {
    ...    
});
```    

## Acknowledgements

This client SDK was created and currently maintained by *Sergey Seroukhov*.

---
_Source: https://npm.io/package/pip-clients-creditcards-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
