Skip to content

Commit

Permalink
Merge pull request #751 from inplayer-org/fix/wrong-data-types
Browse files Browse the repository at this point in the history
Fix: Wrong data types
  • Loading branch information
Jasminna authored Dec 7, 2021
2 parents 4c419e9 + 0aaf9e0 commit e0e2d38
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

# [3.12.3] - 07-12-2021

### Changes

- Fixed wrong data types

# [3.12.2] - 07-12-2021

### Changes
Expand Down
13 changes: 6 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ export interface CredentialsConfig {
expires: number;
}

export interface Credentials {
token: string;
refreshToken: string;
expires: number;
export declare class Credentials {
constructor(data: CredentialsConfig);

isExpired(): boolean;
toObject(): CredentialsConfig;
}
Expand Down Expand Up @@ -178,7 +177,7 @@ export declare class Account {
constructor(config: Record<string, unknown>);

isAuthenticated<R = boolean>(): R | boolean;
getToken<R = CredentialsConfig>(): R | CredentialsConfig;
getToken<R = Credentials>(): R | Credentials;
setToken<R = void>(
token: string,
refreshToken: string,
Expand Down Expand Up @@ -567,8 +566,8 @@ export interface DefaultCreditCardData {
cardNumber: string;
cardName: string;
cvc: number;
expMonth: string;
expYear: string;
expMonth: number;
expYear: number;
currency: string;
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@inplayer-org/inplayer.js",
"version": "3.12.1",
"version": "3.12.2",
"author": "InPlayer",
"license": "MIT",
"description": "A Javascript SDK for Inplayer's RESTful API",
Expand Down Expand Up @@ -89,4 +89,4 @@
"webpack-bundle-analyzer": "^4.1.0",
"webpack-cli": "^3.3.12"
}
}
}
16 changes: 8 additions & 8 deletions src/endpoints/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,17 @@ class Payment extends BaseExtend {
* @param {string} cardNumber The card number.
* @param {string} cardName The cardholder's name.
* @param {number} cvc The card CVV number.
* @param {string} expMonth The card expiration month [1...12].
* @param {string} expYear The card expiration year.
* @param {number} expMonth The card expiration month [1...12].
* @param {number} expYear The card expiration year.
* @param {string} currency The currency in which the subscription transactions are conducted.
* @example
* InPlayer.Payment
* .setDefaultCreditCard({
* cardNumber: '4242424242424242',
* cardName: 'John Doe',
* cvc: 123,
* expMonth: '1',
* expYear: '2020',
* expMonth: 1,
* expYear: 2020,
* currency: 'EUR'
* })
* .then(data => console.log(data));
Expand All @@ -548,8 +548,8 @@ class Payment extends BaseExtend {
* {
* number: number;
* card_name: string;
* exp_month: string;
* exp_year: string;
* exp_month: number;
* exp_year: number;
* }
* ```
*/
Expand All @@ -566,8 +566,8 @@ class Payment extends BaseExtend {
cardNumber: string,
cardName: string,
cvc: number,
expMonth: string,
expYear: string,
expMonth: number,
expYear: number,
currency: string,
}): Promise<AxiosResponse<SetDefaultCard>> {
const body = {
Expand Down
16 changes: 8 additions & 8 deletions src/endpoints/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,17 @@ class Subscription extends BaseExtend {
* @param {string} cardNumber The card number.
* @param {string} cardName The cardholder's name.
* @param {number} cvc The card CVV number.
* @param {string} expMonth The card expiration month [1...12].
* @param {string} expYear The card expiration year.
* @param {number} expMonth The card expiration month [1...12].
* @param {number} expYear The card expiration year.
* @param {string} currency The currency in which the subscription transactions are conducted.
* @example
* InPlayer.Payment
* .setDefaultCreditCard({
* cardNumber: '4242424242424242',
* cardName: 'John Doe',
* cvc: 123,
* expMonth: '1',
* expYear: '2020',
* expMonth: 1,
* expYear: 2020,
* currency: 'EUR'
* })
* .then(data => console.log(data));
Expand All @@ -437,8 +437,8 @@ class Subscription extends BaseExtend {
* {
* number: number;
* card_name: string;
* exp_month: string;
* exp_year: string;
* exp_month: number;
* exp_year: number;
* }
* ```
*/
Expand All @@ -455,8 +455,8 @@ class Subscription extends BaseExtend {
cardNumber: string,
cardName: string,
cvc: number,
expMonth: string,
expYear: string,
expMonth: number,
expYear: number,
currency: string,
}): Promise<AxiosResponse<SetDefaultCard>> {
const body = {
Expand Down
3 changes: 1 addition & 2 deletions src/factories/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createTimestamp } from '../helpers';
import { CredentialsConfig } from '../models/CommonInterfaces';

class Credentials {
token: string;
Expand All @@ -16,7 +15,7 @@ class Credentials {
return createTimestamp() > this.expires;
}

toObject(): CredentialsConfig {
toObject() {
return {
token: this.token,
refreshToken: this.refreshToken,
Expand Down
2 changes: 1 addition & 1 deletion src/models/IAccount&Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface SignUpData {
email: string;
password: string;
passwordConfirmation: string;
type: 'consumer' | 'merchant';
type: 'consumer';
grantType?: 'password' | 'client_credentials' | 'refresh_token';
clientId: string;
referrer: string;
Expand Down
4 changes: 2 additions & 2 deletions src/models/IPayment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ export interface DefaultCreditCardData {
cardNumber: string;
cardName: string;
cvc: number;
expMonth: string;
expYear: string;
expMonth: number;
expYear: number;
currency: string;
}

Expand Down

0 comments on commit e0e2d38

Please sign in to comment.