Skip to content

Commit 65e54dc

Browse files
Support special symbols usage in calculateReceivingSignatureValue
1 parent 1a8c114 commit 65e54dc

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## Unreleased
99

1010
### Added
11+
1112
- Allow outSum to be a number or a formatted string.
1213

1314
### Fixed
15+
1416
- Fixed calculating signature value with special symbols in userParams (@ in emails).
1517
- Renamed Email to EMail field in IRobokassaResponse.
1618

1719
## 1.0.1 - 2023-05-13
20+
1821
### Changed
22+
1923
- Translated README.md to Russian language.
2024

2125
## 1.0.0 - 2023-05-12
26+
2227
### Added
28+
2329
- Added `isTest` mode parameter.
2430
- Added `receipt` parameter to conform the fiscal policy.
2531
- Added unit tests.
2632

2733
### Changed
34+
2835
- Rewrote the forked code to use TypeScript.
2936

3037
### Fixed
38+
3139
- Semantic Version calculation errors in the old forked repositories.

src/internal/calculateReceivingSignatureValue.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('#calculateReceivingSignatureValue', () => {
2828
});
2929

3030
expect(result).toEqual(
31-
'200.00:84:my_password2:Shp_email=test%40test.com:Shp_user_id=123',
31+
'200.00:84:my_password2:Shp_email=test@test.com:Shp_user_id=123',
3232
);
3333
});
3434
});

src/internal/calculateReceivingSignatureValue.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ export const buildExpectedReceivingSignatureString = ({
1616
);
1717

1818
const signatureUserParams =
19-
userParameters.map(
20-
([key, value]) => `${key}=${encodeURIComponent(value?.toString() ?? '')}`,
21-
) ?? [];
19+
userParameters.map(([key, value]) => `${key}=${value?.toString() ?? ''}`) ??
20+
[];
2221
// Порядок параметров важен, сортируем по алфавиту
2322
signatureUserParams.sort((a, b) => a.localeCompare(b));
2423

src/internal/calculateSendingSignatureValue.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('#calculateSendingSignatureValue', () => {
3434
});
3535

3636
expect(result).toEqual(
37-
'my_merchant_login:200.00:84:my_password1:Shp_email=test%40test.com:Shp_user_id=123',
37+
'my_merchant_login:200.00:84:my_password1:Shp_email=test@test.com:Shp_user_id=123',
3838
);
3939
});
4040

src/types/IRobokassaResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type IRobokassaResponse = {
2424
/** Контрольная сумма с Пароль#2 */
2525
SignatureValue: string;
2626

27-
/** Способ оплаты который использовал пользователь при совершении платежа.
27+
/** Способ оплаты который использовал пользователь при совершении платежа.
2828
* Напрмер, BankCard */
2929
PaymentMethod: string;
3030

0 commit comments

Comments
 (0)