When called from a snippet procedure, initiates Mobile BankID identification and shows the ongoing status. Will trigger a BankID Completed call for the snippet when the process is completed.
Uses the same configuration as the BankID component.
CREATE PROCEDURE Example.BankIdSnippet
@IsFormSubmit bit = 0,
@IsBankIdIdentify bit = 0,
@PersonalNumber varchar(30) = NULL,
@BankIdSignatureId int = NULL,
@IsError bit = 0,
@ErrorMessage varchar(MAX) = NULL
AS
BEGIN
IF @IsFormSubmit = 1
BEGIN
EXEC SoftadminSnippet.BankId_Identify
@UseQrCode = 1,
@CultureCode = 'en-US';
RETURN;
END;
IF @IsBankIdIdentify = 1
BEGIN
SELECT CONCAT('Personal number: ', ISNULL(@PersonalNumber, 'N/A'), ', ') AS Plaintext;
IF @IsError = 1
BEGIN
SELECT CONCAT('Error: ', @ErrorMessage) AS Plaintext;
RETURN;
END;
SELECT 'Success!' AS Plaintext;
-- Add code for successful identification here.
RETURN;
END;
EXEC SoftadminSnippet.Form
@FormHtml = N'<input type="submit" value="Show QR code">';
SELECT '<div id="BankIdErrorMessage"></div>' AS Html;
END;
CREATE PROCEDURE Example.BankIdSnippet
@IsFormSubmit bit = 0,
@IsBankIdIdentify bit = 0,
@PersonalNumber varchar(30) = NULL,
@BankIdSignatureId int = NULL,
@IsError bit = 0,
@ErrorMessage varchar(MAX) = NULL
AS
BEGIN
IF @IsFormSubmit = 1
BEGIN
DECLARE @EnteredPersonalNumber varchar(30);
SELECT @EnteredPersonalNumber = [Value] FROM #FormValue WHERE [Name] = 'PersonalNumber';
IF SoftadminSnippet.BankId_PersonalNumber_IsValid(@EnteredPersonalNumber) = 0
BEGIN
EXEC SoftadminSnippet.Element_SetContent
@ElementId = N'BankIdErrorMessage',
@Html = N'Invalid personal number.';
RETURN;
END;
EXEC SoftadminSnippet.BankId_Identify
@PersonalNumber = @EnteredPersonalNumber,
@CultureCode = 'en-US';
RETURN;
END;
IF @IsBankIdIdentify = 1
BEGIN
SELECT CONCAT('Personal number: ', @PersonalNumber, ', ') AS Plaintext;
IF @IsError = 1
BEGIN
SELECT CONCAT('Error: ', @ErrorMessage) AS Plaintext;
RETURN;
END;
SELECT 'Success!' AS Plaintext;
-- Add code for successful identification here.
RETURN;
END;
EXEC SoftadminSnippet.Form
@FormHtml = N'<label>Personal number: <input type="text" name="PersonalNumber"></label> <input type="submit">';
SELECT '<div id="BankIdErrorMessage"></div>' AS Html;
END;
Possible value | Description |
---|---|
en-US | English. |
sv-SE | Swedish. |