@figuredev/payments-sdk
Advanced tools
Comparing version 0.25.3 to 0.25.4
@@ -0,3 +1,3 @@ | ||
import { PaymentAuthTokenDTO, PaymentGatewayDTO, PaymentGetResponseDTO, PaymentInitializedResponseDTO, PaymentInputDTO, PaymentRequestDTO, PaymentRequestSaveDTO } from "./types"; | ||
import { UserContext } from "./utils"; | ||
import { PaymentAuthTokenDTO, PaymentGatewayDTO, PaymentGetResponseDTO, PaymentInitializedResponseDTO, PaymentInputDTO, PaymentRequestDTO, PaymentRequestSaveDTO } from "./types"; | ||
declare type PaymentsClientConfig = { | ||
@@ -20,4 +20,5 @@ baseUrl: string; | ||
getPaymentInfo(ctx: UserContext, id: string): Promise<PaymentGetResponseDTO>; | ||
getPaymentAudit(ctx: UserContext, id: string): Promise<unknown[]>; | ||
getAuthenticationToken(ctx: UserContext, gateway: PaymentGatewayDTO, amount?: number): Promise<PaymentAuthTokenDTO>; | ||
} | ||
export {}; |
@@ -14,4 +14,4 @@ "use strict"; | ||
const axios_1 = require("axios"); | ||
const types_1 = require("./types"); | ||
const utils_1 = require("./utils"); | ||
const types_1 = require("./types"); | ||
class PaymentsClient { | ||
@@ -28,3 +28,3 @@ constructor(config) { | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: Object.assign(Object.assign({}, data), { command: types_1.PaymentCommandDTO.Sale }), | ||
@@ -42,3 +42,3 @@ }) | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: Object.assign(Object.assign({}, data), { command: types_1.PaymentCommandDTO.Auth }), | ||
@@ -57,3 +57,3 @@ }) | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -68,3 +68,3 @@ command: types_1.PaymentCommandDTO.TipAdjust, | ||
} | ||
// amount is difference amount: amount to refund or null for full refund | ||
// amount is difference amount: positive amount to refund or null for full refund | ||
refund(ctx, id, referenceId, amount) { | ||
@@ -77,3 +77,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -96,3 +96,3 @@ command: types_1.PaymentCommandDTO.Refund, | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -114,3 +114,3 @@ command: types_1.PaymentCommandDTO.Capture, | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -131,3 +131,3 @@ command: types_1.PaymentCommandDTO.Void, | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -149,3 +149,3 @@ command: types_1.PaymentCommandDTO.Tokenize, | ||
url: `/payment/${id}/cancel`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: { | ||
@@ -165,3 +165,3 @@ referenceId: referenceId, | ||
url: `/payment/${id}/save`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: data, | ||
@@ -179,3 +179,3 @@ }) | ||
url: `/payment/${id}`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
}) | ||
@@ -185,2 +185,14 @@ .then((r) => r.data); | ||
} | ||
getPaymentAudit(ctx, id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield axios_1.default | ||
.request({ | ||
baseURL: this.config.baseUrl, | ||
method: "GET", | ||
url: `/payment-audit/${id}`, | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
}) | ||
.then((r) => r.data); | ||
}); | ||
} | ||
getAuthenticationToken(ctx, gateway, amount) { | ||
@@ -193,3 +205,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
url: `/auth-token`, | ||
headers: utils_1.constructHeaders(this.config.secret, ctx), | ||
headers: (0, utils_1.constructHeaders)(this.config.secret, ctx), | ||
data: Object.assign({ gateway: gateway }, (amount == null ? null : { amount: amount })), | ||
@@ -196,0 +208,0 @@ }) |
@@ -65,3 +65,5 @@ import { Maybe } from "fgr-lib-backend/lib/types"; | ||
OtherReason = "OtherReason", | ||
OtherReasonPossibleFraud = "OtherReasonPossibleFraud" | ||
OtherReasonPossibleFraud = "OtherReasonPossibleFraud", | ||
ConnectionToGatewayTimedout = "ConnectionToGatewayTimedout", | ||
Cancelled = "Cancelled" | ||
} | ||
@@ -68,0 +70,0 @@ export declare type PaymentRequestSaveDTO = { |
@@ -53,2 +53,4 @@ "use strict"; | ||
PaymentDeclineCode["OtherReasonPossibleFraud"] = "OtherReasonPossibleFraud"; | ||
PaymentDeclineCode["ConnectionToGatewayTimedout"] = "ConnectionToGatewayTimedout"; | ||
PaymentDeclineCode["Cancelled"] = "Cancelled"; | ||
})(PaymentDeclineCode = exports.PaymentDeclineCode || (exports.PaymentDeclineCode = {})); | ||
@@ -55,0 +57,0 @@ var PaymentResponseStatusDTO; |
{ | ||
"name": "@figuredev/payments-sdk", | ||
"version": "0.25.3", | ||
"license": "ISC", | ||
"files": [ | ||
"lib/*" | ||
], | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.3.5" | ||
}, | ||
"scripts": { | ||
"prepublish": "yarn build", | ||
"build": "rm -rf lib && tsc" | ||
} | ||
"name": "@figuredev/payments-sdk", | ||
"version": "0.25.4", | ||
"license": "ISC", | ||
"files": [ | ||
"lib/*" | ||
], | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.3.5" | ||
}, | ||
"scripts": { | ||
"prepublish": "yarn build", | ||
"build": "rm -rf lib && tsc" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29146
508
1