saman-payment-pos
    Preparing search index...

    Class Ssp1126Client

    High-level client for the SSP1126 POS terminal over TCP.

    Each public transaction method opens a connection (if needed), runs the multi-step ISO-8583 conversation, sends the closing Dispose message and closes the channel — mirroring the reference Delphi component's blocking Do* methods.

    Index
    • Bill payment (processing code 400000).

      Parameters

      • args: {
            additionalData?: PrintData[];
            billId: string;
            paymentId: string;
            referenceData?: string;
        }

      Returns Promise<TransactionResult>

    • Disconnect the underlying channel.

      Returns void

    • MCI (Hamrah-e-Aval) bill inquiry — processing code 170000, DE46=100.

      The phone number goes in DE60 and the bill type in DE61, matching both reference implementations (DoMCIBillInquery in USSP1126Commander.pas and CreateMCIBillInquery in SSP1126.PcPos.dll).

      Parameters

      Returns Promise<TransactionResult>

    • Abort a POS-started purchase that was started with posStarterPurchaseInit() but won't be completed with posStarterPurchaseFin() (e.g. the customer backed out after tapping their card). Sends Dispose and closes the connection Init left open. Safe to call even when there's nothing pending.

      Returns Promise<void>

    • Step 2 of a POS-started purchase (processing code 000000, DE46=200), mirroring the reference DoPosStarterPurchaseFin. Completes a transaction previously started with posStarterPurchaseInit(), reusing the same still-open connection (this always disposes + closes when it's done, win or lose).

      segment should be the code of one of the segments entries returned by posStarterPurchaseInit() — omit it when Init returned zero or one segment, since there's nothing to choose between (mirrors the reference UI, which only shows its segment picker when there's more than one option).

      Parameters

      • args: {
            additionalData?: PrintData[];
            amounts?: string;
            mainAmount: number;
            purchaseId?: string;
            referenceData?: string;
            segment?: string;
            terminalId?: string;
        }

      Returns Promise<TransactionResult>

    • Step 1 of a purchase started by the POS terminal itself (processing code 000000, DE46=100), mirroring the reference DoPosStarterPurchaseInit. Unlike purchase() (PC-started), the customer taps/inserts their card at the terminal before the PC knows the amount: this step just asks the terminal to read the card and report which payment segments/routing options it offers (usually one).

      On success the underlying connection is deliberately left open — exactly like the reference component — so posStarterPurchaseFin() can complete the same transaction on the same connection. On failure it disposes and closes as usual, same as every other method here. If you decide not to proceed after a successful Init (customer backs out, UI abandoned, etc.), call posStarterPurchaseCancel() to clean up rather than leaving the connection open indefinitely.

      Returns Promise<PosStarterPurchaseInitResult>

    • Purchase started by the PC (processing code 000000). Skips the intermediate card-read step; goes straight to the financial result.

      purchaseId selects a different transaction type — leave it unset for an ordinary sale. Populating DE63 turns the request into an identified purchase ("خرید شناسه‌دار"), which the vendor added as a distinct feature in v1.0.1 of the web service and which the acquirer provisions separately. The vendor docs are explicit: "to perform an identified purchase this parameter must be populated with the purchase identifier; otherwise, for a normal purchase transaction, its default value is null." The C# CreatePcStarterPurchase accordingly sets DE63 only when the value is non-empty.

      If you just want your own order number on the receipt, use referenceData (DE56) or additionalData (DE48) — not this.

      Parameters

      • args: {
            additionalData?: PrintData[];
            amounts?: string;
            mainAmount: number;
            purchaseId?: string;
            referenceData?: string;
            terminalId?: string;
        }
        • OptionaladditionalData?: PrintData[]
        • Optionalamounts?: string
        • mainAmount: number
        • OptionalpurchaseId?: string

          Only for an identified purchase (DE63). Omit for a normal sale — see above.

        • OptionalreferenceData?: string
        • OptionalterminalId?: string

      Returns Promise<TransactionResult>

    • Top-up charge for a mobile number (processing code 370000).

      Parameters

      • args: { additionalData?: PrintData[]; mobileNumber: string; referenceData?: string }

      Returns Promise<TransactionResult>

    • Aggregate totals report between two dates (processing code 380000).

      Parameters

      • args: { fromDate: string; posPin?: string; toDate: string }

      Returns Promise<TotalReportResult>