"1002",
"VK_VERSION" => "008",
"VK_SND_ID" => "uid100010",
"VK_STAMP" => "316",
"VK_AMOUNT" => "0.01",
"VK_CURR" => "EUR",
"VK_ACC" => "LT657300010135270430",
"VK_NAME" => "BIGBANK AS FILIALAS",
"VK_REF" => "3162",
"VK_MSG" => "3de721f292b7aa1185ebd9a8a233f8de",
"VK_RETURN" => "https://dsm-banklink-frontend-lt-test.dca.origin.big.local/r",
"VK_CANCEL" => "https://dsm-banklink-frontend-lt-test.dca.origin.big.local/r",
"VK_LANG" => "LIT",
"VK_ENCODING" => "UTF-8"
);
// STEP 3. Generate data to be signed
// ==================================
// Data to be signed is in the form of XXXYYYYY where XXX is 3 char
// zero padded length of the value and YYY the value itself
// NB! Swedbank Lithuania expects symbol count, not byte count with UTF-8,
// so use `mb_strlen` instead of `strlen` to detect the length of a string
$data = str_pad (mb_strlen($fields["VK_SERVICE"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SERVICE"] . /* 1002 */
str_pad (mb_strlen($fields["VK_VERSION"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_VERSION"] . /* 008 */
str_pad (mb_strlen($fields["VK_SND_ID"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_SND_ID"] . /* uid100010 */
str_pad (mb_strlen($fields["VK_STAMP"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_STAMP"] . /* 316 */
str_pad (mb_strlen($fields["VK_AMOUNT"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_AMOUNT"] . /* 0.01 */
str_pad (mb_strlen($fields["VK_CURR"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_CURR"] . /* EUR */
str_pad (mb_strlen($fields["VK_REF"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_REF"] . /* 3162 */
str_pad (mb_strlen($fields["VK_MSG"], "UTF-8"), 3, "0", STR_PAD_LEFT) . $fields["VK_MSG"]; /* 3de721f292b7aa1185ebd9a8a233f8de */
/* $data = "0041002003008009uid1000100033160040.01003EUR00431620323de721f292b7aa1185ebd9a8a233f8de"; */
// STEP 4. Sign the data with RSA-SHA1 to generate MAC code
// ========================================================
openssl_sign ($data, $signature, $private_key, OPENSSL_ALGO_SHA1);
/* BcWaS6A6BHt1l32O4sDJKem8WkskOwAHCVo8Wcg1Yi5VQ/crPHgUllraWZZk9mSRQ5QZRA+WjNJei7oAH4a/IjQe3MpLd9cUG32Cnt2ZAJKHFbs3cGN8qZcT9MUPYXG9rl9VDfR4dxZnsbC7giGZepc/+HAeHsBu20hCiCIk9C3ZXPkHCyoHQJNDDmTONGoEElKULhL2SWVuy4j45WZRYylcpalEMOZ2TcP9KwrZ0hqh+rxgxKVETyo6OCMip/Gdzu8vK6EO3f6x8cgab75PQNI/3znfkk2s4y3JOiWdopfQfbk3yURLx5U296bU567VsHYm4yg1D99xengMrD61MA== */
$fields["VK_MAC"] = base64_encode($signature);
// STEP 5. Generate POST form with payment data that will be sent to the bank
// ==========================================================================
?>
Makse teostamise näidisrakendus "Swedbank Lithuania"