typescript-pos 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +5 -3
- package/dist/index.cjs +991 -227
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -10
- package/dist/index.d.ts +93 -10
- package/dist/index.js +990 -227
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/README.tr.md +0 -173
package/dist/index.d.cts
CHANGED
|
@@ -103,6 +103,7 @@ type PosOrder = Record<string, unknown> & {
|
|
|
103
103
|
auth_code?: string;
|
|
104
104
|
pre_auth_amount?: number;
|
|
105
105
|
order_type?: string;
|
|
106
|
+
payment_token?: string;
|
|
106
107
|
};
|
|
107
108
|
/** Callback POST body sent back by the bank. */
|
|
108
109
|
type GatewayResponseData = Record<string, string | undefined>;
|
|
@@ -468,10 +469,10 @@ type ShippedPosConfig<Bank extends string> = {
|
|
|
468
469
|
};
|
|
469
470
|
|
|
470
471
|
/** Bank keys of `posProductionConfig`. */
|
|
471
|
-
type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank' | 'sekerbank' | 'vakifbank' | 'ziraat-vpos' | 'ziraat-asseco';
|
|
472
|
+
type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank' | 'sekerbank' | 'vakifbank' | 'vakifbank-cp' | 'ziraat-vpos' | 'ziraat-asseco';
|
|
472
473
|
/**
|
|
473
|
-
* Production endpoints for the AssecoPos and
|
|
474
|
-
* API gateway on port 8443). Copy and adjust the entries you use; `require_3d_hash` is left at its default.
|
|
474
|
+
* Production endpoints for the AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos banks (the VakifBank
|
|
475
|
+
* API gateway on port 8443; `vakifbank-cp` is the Common Payment hosted page). Copy and adjust the entries you use; `require_3d_hash` is left at its default.
|
|
475
476
|
*
|
|
476
477
|
* Deeply frozen: spread an entry into a new object to change it
|
|
477
478
|
* (`{ ...posProductionConfig.banks.vakifbank, require_3d_hash: true }`).
|
|
@@ -479,10 +480,10 @@ type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank'
|
|
|
479
480
|
declare const posProductionConfig: ShippedPosConfig<PosProductionBank>;
|
|
480
481
|
|
|
481
482
|
/** Bank keys of `posTestConfig`. */
|
|
482
|
-
type PosTestBank = 'asseco' | 'vakifbank' | 'ziraat-vpos';
|
|
483
|
+
type PosTestBank = 'asseco' | 'vakifbank' | 'vakifbank-cp' | 'ziraat-vpos';
|
|
483
484
|
/**
|
|
484
|
-
* Test endpoints for the AssecoPos and
|
|
485
|
-
* gateway on port 8443). `test_mode` only changes request data for gateways that support it; for these
|
|
485
|
+
* Test endpoints for the AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos banks (the VakifBank test API
|
|
486
|
+
* gateway on port 8443; `vakifbank-cp` is the Common Payment hosted page). `test_mode` only changes request data for gateways that support it; for these
|
|
486
487
|
* gateways the environment is selected by the endpoint URLs.
|
|
487
488
|
*
|
|
488
489
|
* Deeply frozen: spread an entry into a new object to change it
|
|
@@ -515,7 +516,7 @@ declare class NotImplementedError extends PosError {
|
|
|
515
516
|
declare class InvalidCardError extends PosError {
|
|
516
517
|
}
|
|
517
518
|
/** Callback field that did not match the order / account. */
|
|
518
|
-
type OrderMismatchField = 'order_id' | 'amount' | 'currency' | 'merchant_id' | 'storetype';
|
|
519
|
+
type OrderMismatchField = 'order_id' | 'amount' | 'currency' | 'merchant_id' | 'storetype' | 'transaction_id' | 'transaction_type';
|
|
519
520
|
declare class OrderMismatchError extends PosError {
|
|
520
521
|
readonly field: OrderMismatchField;
|
|
521
522
|
readonly expected: string;
|
|
@@ -595,7 +596,7 @@ type PosFactoryOptions = {
|
|
|
595
596
|
testMode?: boolean;
|
|
596
597
|
};
|
|
597
598
|
/**
|
|
598
|
-
* Builds AssecoPos and
|
|
599
|
+
* Builds AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos gateways: the gateway class is picked by `GatewayConfig.class` and wired with its crypt, mappers and HTTP clients.
|
|
599
600
|
*/
|
|
600
601
|
declare const PosFactory: {
|
|
601
602
|
/**
|
|
@@ -652,6 +653,88 @@ declare class AssecoPos extends AbstractGateway<AssecoPosAccount> {
|
|
|
652
653
|
private assertCallbackMatchesOrder;
|
|
653
654
|
}
|
|
654
655
|
|
|
656
|
+
/**
|
|
657
|
+
* VakifBank Common Payment (Ortak Ödeme): the card page is hosted by the bank.
|
|
658
|
+
*
|
|
659
|
+
* - `get3DFormData` registers the payment (`CreateToken`) and returns a GET redirect to `CommonPaymentUrl`
|
|
660
|
+
* carrying `Ptkn`. It continues only when the answer has a payment token and an `https:` payment URL and
|
|
661
|
+
* reports no error (`ErrorCode` empty or `0000`, `StatusCode` absent or `0`); anything else is a `PosError`.
|
|
662
|
+
* - The browser callback to the success/fail URL is informational only and carries no signature
|
|
663
|
+
* (VakifBank Common Payment guide v2.1 §5, §6.4). `make3DPayPayment` / `make3DHostPayment` therefore always ask
|
|
664
|
+
* the transaction query API (`GetVposTransaction`, guide §6.5); only the query answer decides the status, in
|
|
665
|
+
* both directions.
|
|
666
|
+
* - When the order carries its own `transaction_id` and/or `payment_token` (the values used for the
|
|
667
|
+
* registration), the query is built from those order values only. A callback `TransactionId` /
|
|
668
|
+
* `PaymentToken` that contradicts them is an `OrderMismatchError('transaction_id')` with
|
|
669
|
+
* `paymentMayHaveCompleted: false` and no HTTP call. This stops a replay of an earlier transaction of a reused
|
|
670
|
+
* order id (the query API does not report later cancels or refunds). Without order ids the callback
|
|
671
|
+
* `TransactionId` / `PaymentToken` are queried; a callback with neither id is returned as declined without an
|
|
672
|
+
* HTTP call.
|
|
673
|
+
* - An approved query answer must belong to the order: `OrderID` / `OrderId` equals the order id, `Amount`
|
|
674
|
+
* equals the order amount in the cents sent to the bank, `AmountCode` / `CurrencyCode` the order currency (an
|
|
675
|
+
* answer without a currency code is accepted only for TRY), and when present `HostMerchantId` the account
|
|
676
|
+
* merchant id, `TransactionType` the requested transaction type, `TransactionId` the order (or else callback)
|
|
677
|
+
* transaction id and `PaymentToken` the order payment token. A mismatch is an `OrderMismatchError` with
|
|
678
|
+
* `paymentMayHaveCompleted: true`.
|
|
679
|
+
* - A callback that says approved (`Rc` / `RC` / `ResultCode` `0000`) while the query does not confirm it is
|
|
680
|
+
* returned as declined with `requires_manual_review: true`.
|
|
681
|
+
* - `require_3d_hash` does not apply: there is no callback hash to verify; the query and the order binding
|
|
682
|
+
* above take its place.
|
|
683
|
+
* - The registration sends `AllowNotEnrolledCard` `false`, so the bank charges only after full 3-D Secure
|
|
684
|
+
* authentication. Merchants who accept "half secure" payments set it to `'true'` in an
|
|
685
|
+
* `onRequestDataPrepared` hook (guide §5).
|
|
686
|
+
* - `status()` queries a transaction by `transaction_id` or `payment_token`. Capture, cancel and refund go
|
|
687
|
+
* through a `PayFlexV4Pos` gateway (bank `vakifbank`) with `transaction_id` set to the common payment
|
|
688
|
+
* `TransactionId` (guide §8).
|
|
689
|
+
*/
|
|
690
|
+
declare class PayFlexCPV4Pos extends AbstractGateway<PayFlexPosAccount> {
|
|
691
|
+
static readonly NAME = "PayFlex-Common-Payment-V4";
|
|
692
|
+
static readonly GATEWAY_CLASS: string;
|
|
693
|
+
protected static supportedTransactions: SupportedTransactions;
|
|
694
|
+
private readonly cpRequestDataMapper;
|
|
695
|
+
constructor(config: GatewayConfig, account: PayFlexPosAccount, deps: GatewayDeps<PayFlexPosAccount>);
|
|
696
|
+
/**
|
|
697
|
+
* Registers the payment and returns the redirect (GET `CommonPaymentUrl?Ptkn=…`) to the bank card page.
|
|
698
|
+
*
|
|
699
|
+
* @throws UnsupportedFormFormatError for `formFormat: 'html'`
|
|
700
|
+
* @throws PosError when the registration is not accepted
|
|
701
|
+
*/
|
|
702
|
+
get3DFormData(order: PosOrder, paymentModel: PaymentModel, txType: TxType, card?: CreditCard | null, createWithoutCard?: boolean, formFormat?: FormFormat | null): Promise<ThreeDFormData>;
|
|
703
|
+
make3DPayment(_gatewayResponseData: GatewayResponseData, _order: PosOrder, _txType: TxType, _card?: CreditCard | null): Promise<PosResponse>;
|
|
704
|
+
/**
|
|
705
|
+
* @throws OrderMismatchError when the approved query answer belongs to another payment
|
|
706
|
+
* @throws PosHttpError when the query fails or answers something that is not JSON/XML (e.g. an HTML page)
|
|
707
|
+
*/
|
|
708
|
+
make3DPayPayment(gatewayResponseData: GatewayResponseData, order: PosOrder, txType: TxType): Promise<PosResponse>;
|
|
709
|
+
/**
|
|
710
|
+
* @throws OrderMismatchError when the approved query answer belongs to another payment
|
|
711
|
+
* @throws PosHttpError when the query fails or answers something that is not JSON/XML (e.g. an HTML page)
|
|
712
|
+
*/
|
|
713
|
+
make3DHostPayment(gatewayResponseData: GatewayResponseData, order: PosOrder, txType: TxType): Promise<PosResponse>;
|
|
714
|
+
makeRegularPayment(_order: PosOrder, _card: CreditCard, _txType: TxType): Promise<PosResponse>;
|
|
715
|
+
makeRegularPostPayment(_order: PosOrder): Promise<PosResponse>;
|
|
716
|
+
cancel(_order: PosOrder): Promise<PosResponse>;
|
|
717
|
+
refund(_order: PosOrder): Promise<PosResponse>;
|
|
718
|
+
orderHistory(_order: PosOrder): Promise<PosResponse>;
|
|
719
|
+
/**
|
|
720
|
+
* Registration succeeds only with a payment token, an `https:` payment URL and no error code
|
|
721
|
+
* (VakifBank Common Payment guide v2.1 §4: `ErrorCode` is set only on failure).
|
|
722
|
+
*/
|
|
723
|
+
private assertRegistered;
|
|
724
|
+
/**
|
|
725
|
+
* Confirms the browser callback with the transaction query (VakifBank Common Payment guide v2.1 §6.4, §6.5) and
|
|
726
|
+
* binds an approved answer to the order. The callback result code never decides the status.
|
|
727
|
+
*
|
|
728
|
+
* @throws OrderMismatchError (`paymentMayHaveCompleted: false`, no HTTP call) when the callback ids contradict
|
|
729
|
+
* the order's `transaction_id` / `payment_token`
|
|
730
|
+
*/
|
|
731
|
+
private completeHostedPayment;
|
|
732
|
+
/** A callback id that contradicts the order's own id: rejected before any HTTP call. */
|
|
733
|
+
private rejectCallbackId;
|
|
734
|
+
/** Binds an approved query answer to the order (fail closed: a missing required value never matches). */
|
|
735
|
+
private assertAnswerMatchesOrder;
|
|
736
|
+
}
|
|
737
|
+
|
|
655
738
|
type Raw = Record<string, unknown>;
|
|
656
739
|
/**
|
|
657
740
|
* PayFlex MPI ISD v4 (Innova), used by VakifBank VPOS 7/24 and Ziraat.
|
|
@@ -710,7 +793,7 @@ declare class PayFlexV4Pos extends AbstractGateway<PayFlexPosAccount> {
|
|
|
710
793
|
declare function maskSensitiveData<T>(data: T): T;
|
|
711
794
|
|
|
712
795
|
/** Library version. Hand-maintained; must equal package.json `version` (enforced by tests/unit/smoke.test.ts). */
|
|
713
|
-
declare const VERSION = "0.
|
|
796
|
+
declare const VERSION = "0.2.0";
|
|
714
797
|
|
|
715
|
-
export { AbstractGateway, AbstractPosAccount, AccountFactory, AssecoPos, AssecoPosAccount, CARD_TYPE, CURRENCY, CardTypeNotSupportedError, CardTypeRequiredError, CreditCard, CreditCardFactory, FORM_FORMAT, GatewayClassNotConfiguredError, HashMismatchError, HttpTransport, InvalidCardError, LANG, MODEL, MissingAccountInfoError, NotImplementedError, OrderMismatchError, PAYMENT_STATUS, PayFlexPosAccount, PayFlexV4Pos, PosError, PosFactory, PosHttpError, TX_TYPE, UnsupportedFormFormatError, UnsupportedPaymentModelError, UnsupportedTransactionTypeError, VERSION, maskSensitiveData, noopLogger, posProductionConfig, posTestConfig };
|
|
798
|
+
export { AbstractGateway, AbstractPosAccount, AccountFactory, AssecoPos, AssecoPosAccount, CARD_TYPE, CURRENCY, CardTypeNotSupportedError, CardTypeRequiredError, CreditCard, CreditCardFactory, FORM_FORMAT, GatewayClassNotConfiguredError, HashMismatchError, HttpTransport, InvalidCardError, LANG, MODEL, MissingAccountInfoError, NotImplementedError, OrderMismatchError, PAYMENT_STATUS, PayFlexCPV4Pos, PayFlexPosAccount, PayFlexV4Pos, PosError, PosFactory, PosHttpError, TX_TYPE, UnsupportedFormFormatError, UnsupportedPaymentModelError, UnsupportedTransactionTypeError, VERSION, maskSensitiveData, noopLogger, posProductionConfig, posTestConfig };
|
|
716
799
|
export type { AbstractGatewayLike, Before3DFormHashCalculatedEvent, CardExpiration, CardType, CryptInterface, Currency, EncodedData, FormFormat, GatewayConfig, GatewayDeps, GatewayResponseData, HttpTransportOptions, HttpTransportResponse, Lang, OrderMismatchField, PaymentModel, PaymentStatus, PosConfig, PosFactoryOptions, PosHooks, PosHttpErrorInfo, PosLogger, PosOrder, PosProductionBank, PosResponse, PosTestBank, RecurringFrequency, RequestDataMapperInterface, RequestDataPreparedEvent, RequestTxTypeMappings, RequestValueFormatterInterface, RequestValueMapperInterface, ResponseDataMapperInterface, ShippedPosConfig, SupportedTransactions, ThreeDFormData, TxType };
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ type PosOrder = Record<string, unknown> & {
|
|
|
103
103
|
auth_code?: string;
|
|
104
104
|
pre_auth_amount?: number;
|
|
105
105
|
order_type?: string;
|
|
106
|
+
payment_token?: string;
|
|
106
107
|
};
|
|
107
108
|
/** Callback POST body sent back by the bank. */
|
|
108
109
|
type GatewayResponseData = Record<string, string | undefined>;
|
|
@@ -468,10 +469,10 @@ type ShippedPosConfig<Bank extends string> = {
|
|
|
468
469
|
};
|
|
469
470
|
|
|
470
471
|
/** Bank keys of `posProductionConfig`. */
|
|
471
|
-
type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank' | 'sekerbank' | 'vakifbank' | 'ziraat-vpos' | 'ziraat-asseco';
|
|
472
|
+
type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank' | 'sekerbank' | 'vakifbank' | 'vakifbank-cp' | 'ziraat-vpos' | 'ziraat-asseco';
|
|
472
473
|
/**
|
|
473
|
-
* Production endpoints for the AssecoPos and
|
|
474
|
-
* API gateway on port 8443). Copy and adjust the entries you use; `require_3d_hash` is left at its default.
|
|
474
|
+
* Production endpoints for the AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos banks (the VakifBank
|
|
475
|
+
* API gateway on port 8443; `vakifbank-cp` is the Common Payment hosted page). Copy and adjust the entries you use; `require_3d_hash` is left at its default.
|
|
475
476
|
*
|
|
476
477
|
* Deeply frozen: spread an entry into a new object to change it
|
|
477
478
|
* (`{ ...posProductionConfig.banks.vakifbank, require_3d_hash: true }`).
|
|
@@ -479,10 +480,10 @@ type PosProductionBank = 'akbank' | 'finansbank' | 'halkbank' | 'teb' | 'isbank'
|
|
|
479
480
|
declare const posProductionConfig: ShippedPosConfig<PosProductionBank>;
|
|
480
481
|
|
|
481
482
|
/** Bank keys of `posTestConfig`. */
|
|
482
|
-
type PosTestBank = 'asseco' | 'vakifbank' | 'ziraat-vpos';
|
|
483
|
+
type PosTestBank = 'asseco' | 'vakifbank' | 'vakifbank-cp' | 'ziraat-vpos';
|
|
483
484
|
/**
|
|
484
|
-
* Test endpoints for the AssecoPos and
|
|
485
|
-
* gateway on port 8443). `test_mode` only changes request data for gateways that support it; for these
|
|
485
|
+
* Test endpoints for the AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos banks (the VakifBank test API
|
|
486
|
+
* gateway on port 8443; `vakifbank-cp` is the Common Payment hosted page). `test_mode` only changes request data for gateways that support it; for these
|
|
486
487
|
* gateways the environment is selected by the endpoint URLs.
|
|
487
488
|
*
|
|
488
489
|
* Deeply frozen: spread an entry into a new object to change it
|
|
@@ -515,7 +516,7 @@ declare class NotImplementedError extends PosError {
|
|
|
515
516
|
declare class InvalidCardError extends PosError {
|
|
516
517
|
}
|
|
517
518
|
/** Callback field that did not match the order / account. */
|
|
518
|
-
type OrderMismatchField = 'order_id' | 'amount' | 'currency' | 'merchant_id' | 'storetype';
|
|
519
|
+
type OrderMismatchField = 'order_id' | 'amount' | 'currency' | 'merchant_id' | 'storetype' | 'transaction_id' | 'transaction_type';
|
|
519
520
|
declare class OrderMismatchError extends PosError {
|
|
520
521
|
readonly field: OrderMismatchField;
|
|
521
522
|
readonly expected: string;
|
|
@@ -595,7 +596,7 @@ type PosFactoryOptions = {
|
|
|
595
596
|
testMode?: boolean;
|
|
596
597
|
};
|
|
597
598
|
/**
|
|
598
|
-
* Builds AssecoPos and
|
|
599
|
+
* Builds AssecoPos, PayFlexV4Pos and PayFlexCPV4Pos gateways: the gateway class is picked by `GatewayConfig.class` and wired with its crypt, mappers and HTTP clients.
|
|
599
600
|
*/
|
|
600
601
|
declare const PosFactory: {
|
|
601
602
|
/**
|
|
@@ -652,6 +653,88 @@ declare class AssecoPos extends AbstractGateway<AssecoPosAccount> {
|
|
|
652
653
|
private assertCallbackMatchesOrder;
|
|
653
654
|
}
|
|
654
655
|
|
|
656
|
+
/**
|
|
657
|
+
* VakifBank Common Payment (Ortak Ödeme): the card page is hosted by the bank.
|
|
658
|
+
*
|
|
659
|
+
* - `get3DFormData` registers the payment (`CreateToken`) and returns a GET redirect to `CommonPaymentUrl`
|
|
660
|
+
* carrying `Ptkn`. It continues only when the answer has a payment token and an `https:` payment URL and
|
|
661
|
+
* reports no error (`ErrorCode` empty or `0000`, `StatusCode` absent or `0`); anything else is a `PosError`.
|
|
662
|
+
* - The browser callback to the success/fail URL is informational only and carries no signature
|
|
663
|
+
* (VakifBank Common Payment guide v2.1 §5, §6.4). `make3DPayPayment` / `make3DHostPayment` therefore always ask
|
|
664
|
+
* the transaction query API (`GetVposTransaction`, guide §6.5); only the query answer decides the status, in
|
|
665
|
+
* both directions.
|
|
666
|
+
* - When the order carries its own `transaction_id` and/or `payment_token` (the values used for the
|
|
667
|
+
* registration), the query is built from those order values only. A callback `TransactionId` /
|
|
668
|
+
* `PaymentToken` that contradicts them is an `OrderMismatchError('transaction_id')` with
|
|
669
|
+
* `paymentMayHaveCompleted: false` and no HTTP call. This stops a replay of an earlier transaction of a reused
|
|
670
|
+
* order id (the query API does not report later cancels or refunds). Without order ids the callback
|
|
671
|
+
* `TransactionId` / `PaymentToken` are queried; a callback with neither id is returned as declined without an
|
|
672
|
+
* HTTP call.
|
|
673
|
+
* - An approved query answer must belong to the order: `OrderID` / `OrderId` equals the order id, `Amount`
|
|
674
|
+
* equals the order amount in the cents sent to the bank, `AmountCode` / `CurrencyCode` the order currency (an
|
|
675
|
+
* answer without a currency code is accepted only for TRY), and when present `HostMerchantId` the account
|
|
676
|
+
* merchant id, `TransactionType` the requested transaction type, `TransactionId` the order (or else callback)
|
|
677
|
+
* transaction id and `PaymentToken` the order payment token. A mismatch is an `OrderMismatchError` with
|
|
678
|
+
* `paymentMayHaveCompleted: true`.
|
|
679
|
+
* - A callback that says approved (`Rc` / `RC` / `ResultCode` `0000`) while the query does not confirm it is
|
|
680
|
+
* returned as declined with `requires_manual_review: true`.
|
|
681
|
+
* - `require_3d_hash` does not apply: there is no callback hash to verify; the query and the order binding
|
|
682
|
+
* above take its place.
|
|
683
|
+
* - The registration sends `AllowNotEnrolledCard` `false`, so the bank charges only after full 3-D Secure
|
|
684
|
+
* authentication. Merchants who accept "half secure" payments set it to `'true'` in an
|
|
685
|
+
* `onRequestDataPrepared` hook (guide §5).
|
|
686
|
+
* - `status()` queries a transaction by `transaction_id` or `payment_token`. Capture, cancel and refund go
|
|
687
|
+
* through a `PayFlexV4Pos` gateway (bank `vakifbank`) with `transaction_id` set to the common payment
|
|
688
|
+
* `TransactionId` (guide §8).
|
|
689
|
+
*/
|
|
690
|
+
declare class PayFlexCPV4Pos extends AbstractGateway<PayFlexPosAccount> {
|
|
691
|
+
static readonly NAME = "PayFlex-Common-Payment-V4";
|
|
692
|
+
static readonly GATEWAY_CLASS: string;
|
|
693
|
+
protected static supportedTransactions: SupportedTransactions;
|
|
694
|
+
private readonly cpRequestDataMapper;
|
|
695
|
+
constructor(config: GatewayConfig, account: PayFlexPosAccount, deps: GatewayDeps<PayFlexPosAccount>);
|
|
696
|
+
/**
|
|
697
|
+
* Registers the payment and returns the redirect (GET `CommonPaymentUrl?Ptkn=…`) to the bank card page.
|
|
698
|
+
*
|
|
699
|
+
* @throws UnsupportedFormFormatError for `formFormat: 'html'`
|
|
700
|
+
* @throws PosError when the registration is not accepted
|
|
701
|
+
*/
|
|
702
|
+
get3DFormData(order: PosOrder, paymentModel: PaymentModel, txType: TxType, card?: CreditCard | null, createWithoutCard?: boolean, formFormat?: FormFormat | null): Promise<ThreeDFormData>;
|
|
703
|
+
make3DPayment(_gatewayResponseData: GatewayResponseData, _order: PosOrder, _txType: TxType, _card?: CreditCard | null): Promise<PosResponse>;
|
|
704
|
+
/**
|
|
705
|
+
* @throws OrderMismatchError when the approved query answer belongs to another payment
|
|
706
|
+
* @throws PosHttpError when the query fails or answers something that is not JSON/XML (e.g. an HTML page)
|
|
707
|
+
*/
|
|
708
|
+
make3DPayPayment(gatewayResponseData: GatewayResponseData, order: PosOrder, txType: TxType): Promise<PosResponse>;
|
|
709
|
+
/**
|
|
710
|
+
* @throws OrderMismatchError when the approved query answer belongs to another payment
|
|
711
|
+
* @throws PosHttpError when the query fails or answers something that is not JSON/XML (e.g. an HTML page)
|
|
712
|
+
*/
|
|
713
|
+
make3DHostPayment(gatewayResponseData: GatewayResponseData, order: PosOrder, txType: TxType): Promise<PosResponse>;
|
|
714
|
+
makeRegularPayment(_order: PosOrder, _card: CreditCard, _txType: TxType): Promise<PosResponse>;
|
|
715
|
+
makeRegularPostPayment(_order: PosOrder): Promise<PosResponse>;
|
|
716
|
+
cancel(_order: PosOrder): Promise<PosResponse>;
|
|
717
|
+
refund(_order: PosOrder): Promise<PosResponse>;
|
|
718
|
+
orderHistory(_order: PosOrder): Promise<PosResponse>;
|
|
719
|
+
/**
|
|
720
|
+
* Registration succeeds only with a payment token, an `https:` payment URL and no error code
|
|
721
|
+
* (VakifBank Common Payment guide v2.1 §4: `ErrorCode` is set only on failure).
|
|
722
|
+
*/
|
|
723
|
+
private assertRegistered;
|
|
724
|
+
/**
|
|
725
|
+
* Confirms the browser callback with the transaction query (VakifBank Common Payment guide v2.1 §6.4, §6.5) and
|
|
726
|
+
* binds an approved answer to the order. The callback result code never decides the status.
|
|
727
|
+
*
|
|
728
|
+
* @throws OrderMismatchError (`paymentMayHaveCompleted: false`, no HTTP call) when the callback ids contradict
|
|
729
|
+
* the order's `transaction_id` / `payment_token`
|
|
730
|
+
*/
|
|
731
|
+
private completeHostedPayment;
|
|
732
|
+
/** A callback id that contradicts the order's own id: rejected before any HTTP call. */
|
|
733
|
+
private rejectCallbackId;
|
|
734
|
+
/** Binds an approved query answer to the order (fail closed: a missing required value never matches). */
|
|
735
|
+
private assertAnswerMatchesOrder;
|
|
736
|
+
}
|
|
737
|
+
|
|
655
738
|
type Raw = Record<string, unknown>;
|
|
656
739
|
/**
|
|
657
740
|
* PayFlex MPI ISD v4 (Innova), used by VakifBank VPOS 7/24 and Ziraat.
|
|
@@ -710,7 +793,7 @@ declare class PayFlexV4Pos extends AbstractGateway<PayFlexPosAccount> {
|
|
|
710
793
|
declare function maskSensitiveData<T>(data: T): T;
|
|
711
794
|
|
|
712
795
|
/** Library version. Hand-maintained; must equal package.json `version` (enforced by tests/unit/smoke.test.ts). */
|
|
713
|
-
declare const VERSION = "0.
|
|
796
|
+
declare const VERSION = "0.2.0";
|
|
714
797
|
|
|
715
|
-
export { AbstractGateway, AbstractPosAccount, AccountFactory, AssecoPos, AssecoPosAccount, CARD_TYPE, CURRENCY, CardTypeNotSupportedError, CardTypeRequiredError, CreditCard, CreditCardFactory, FORM_FORMAT, GatewayClassNotConfiguredError, HashMismatchError, HttpTransport, InvalidCardError, LANG, MODEL, MissingAccountInfoError, NotImplementedError, OrderMismatchError, PAYMENT_STATUS, PayFlexPosAccount, PayFlexV4Pos, PosError, PosFactory, PosHttpError, TX_TYPE, UnsupportedFormFormatError, UnsupportedPaymentModelError, UnsupportedTransactionTypeError, VERSION, maskSensitiveData, noopLogger, posProductionConfig, posTestConfig };
|
|
798
|
+
export { AbstractGateway, AbstractPosAccount, AccountFactory, AssecoPos, AssecoPosAccount, CARD_TYPE, CURRENCY, CardTypeNotSupportedError, CardTypeRequiredError, CreditCard, CreditCardFactory, FORM_FORMAT, GatewayClassNotConfiguredError, HashMismatchError, HttpTransport, InvalidCardError, LANG, MODEL, MissingAccountInfoError, NotImplementedError, OrderMismatchError, PAYMENT_STATUS, PayFlexCPV4Pos, PayFlexPosAccount, PayFlexV4Pos, PosError, PosFactory, PosHttpError, TX_TYPE, UnsupportedFormFormatError, UnsupportedPaymentModelError, UnsupportedTransactionTypeError, VERSION, maskSensitiveData, noopLogger, posProductionConfig, posTestConfig };
|
|
716
799
|
export type { AbstractGatewayLike, Before3DFormHashCalculatedEvent, CardExpiration, CardType, CryptInterface, Currency, EncodedData, FormFormat, GatewayConfig, GatewayDeps, GatewayResponseData, HttpTransportOptions, HttpTransportResponse, Lang, OrderMismatchField, PaymentModel, PaymentStatus, PosConfig, PosFactoryOptions, PosHooks, PosHttpErrorInfo, PosLogger, PosOrder, PosProductionBank, PosResponse, PosTestBank, RecurringFrequency, RequestDataMapperInterface, RequestDataPreparedEvent, RequestTxTypeMappings, RequestValueFormatterInterface, RequestValueMapperInterface, ResponseDataMapperInterface, ShippedPosConfig, SupportedTransactions, ThreeDFormData, TxType };
|