Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paid() Method On StatusResponse & Included Type Declarations #27

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
*.lock
package-lock.json
test.js
test.js
.idea/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ $ yarn add paynow
const { Paynow } = require("paynow");
```

### Importing library (Typescript)

```javascript
import { Paynow } from "paynow";
```


Create an instance of the Paynow class optionally setting the result and return url(s)

```javascript
Expand Down
1 change: 1 addition & 0 deletions dist/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/constants.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/declarations/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare const RESPONSE_OK: string;
export declare const RESPONSE_ERROR: string;
export declare const URL_INITIATE_TRANSACTION: string;
export declare const URL_INITIATE_MOBILE_TRANSACTION: string;
3 changes: 3 additions & 0 deletions dist/declarations/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as Payment } from "./types/payment";
export { CartItem, default as Cart } from "./types/cart";
export { default as Paynow, StatusResponse, InitResponse } from './paynow';
56 changes: 56 additions & 0 deletions dist/declarations/paynow.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Payment from "./types/payment";
export declare class StatusResponse {
reference: String;
amount: String;
paynowReference: String;
pollUrl: String;
status: String;
error: String;
constructor(data: any);
paid(): boolean;
}
export declare class InitResponse {
success: boolean;
hasRedirect: boolean;
redirectUrl: String;
error: String;
pollUrl: String;
instructions: String;
status: String;
constructor(data: any);
}
export default class Paynow {
integrationId: string;
integrationKey: string;
resultUrl: string;
returnUrl: string;
constructor(integrationId: string, integrationKey: string, resultUrl: string, returnUrl: string);
send(payment: Payment): Promise<void | InitResponse>;
sendMobile(payment: Payment, phone: string, method: string): Promise<void | InitResponse>;
createPayment(reference: string, authEmail: string): Payment;
fail(message: string): Error;
init(payment: Payment): Promise<void | InitResponse>;
initMobile(payment: Payment, phone: string, method: string): Promise<void | InitResponse>;
isValidEmail(emailAddress: string): boolean;
parse(response: Response): InitResponse;
generateHash(values: {
[key: string]: string;
}, integrationKey: String): any;
verifyHash(values: {
[key: string]: string;
}): boolean;
urlEncode(url: string): string;
urlDecode(url: string): string;
parseQuery(queryString: string): {
[key: string]: string;
};
build(payment: Payment): {
[key: string]: string;
};
buildMobile(payment: Payment, phone: string, method: string): Error | {
[key: string]: string;
};
pollTransaction(url: string): Promise<StatusResponse>;
parseStatusUpdate(response: any): StatusResponse;
validate(payment: Payment): void;
}
14 changes: 14 additions & 0 deletions dist/declarations/types/cart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export declare class CartItem {
title: string;
amount: number;
quantity: number;
constructor(title: string, amount: number, quantity?: number);
}
export default class Cart {
items: CartItem[];
constructor(_items?: CartItem[]);
length(): number;
add(item: CartItem): number;
getTotal(): number;
summary(): string;
}
10 changes: 10 additions & 0 deletions dist/declarations/types/payment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Cart from './cart';
export default class Payment {
reference: string;
authEmail: string;
items: Cart;
constructor(reference: string, authEmail: string, items?: Cart);
add(title: string, amount: number, quantity?: number): Payment;
info(): string;
total(): number;
}
13 changes: 7 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions dist/paynow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading