// Старый способ
import { Personal } from "qiwi-sdk";
const qiwi = new Personal("token", "phone");
// Новый способ
import { Wallet } from "qiwi-sdk";
const qiwi = Wallet.create("token", "phone");
// Совместимый способ
import { Personal, WalletCompat } from "qiwi-sdk";
// Это один класс, экспортированный 2 раза
Personal === WalletCompat;
const qiwi = new Personal("token", "phone");
// Старый способ
import { P2P } from "qiwi-sdk";
const p2p = new P2P("secretKey", "publicKey");
// Новый способ
import { P2p } from "qiwi-sdk";
const p2p = P2p.create("secretKey", "publicKey");
// Совместимый способ
import { P2P, P2pCompat } from "qiwi-sdk";
// Это один класс, экспортированный 2 раза
P2P === P2pCompat;
const p2p = new P2P("secretKey", "publicKey");
// Старый способ
import { Detector } from "qiwi-sdk";
const detector = new Detector();
// Новый способ
import { Detector } from "qiwi-sdk";
const qiwi = Detector.create();
// Совместимый способ
import { DetectorCompat } from "qiwi-sdk";
const detector = new DetectorCompat();
Способ |
Старые сигнатуры |
Новые сигнатуры |
Поддержка* |
Новый |
❎ |
✅ |
✅ |
Совместимый |
✅ |
✅ |
❎ |
* - поддержка в новых версиях и добавление новых методов
Теперь все классы API разбиты на логические подклассы.
Старый способ вызова |
Новый способ вызова |
new Personal(token, walletId?) |
Wallet.create(token, walletId?) |
.getPersonProfile() |
.personProfile.getCurrent() |
.setIdentification() |
.identification.set() |
.getIdentification() |
.identification.get() |
.getLimits<T>() |
.limits.get<T>() |
.getRestrictions() |
.restrictions.get() |
.getPaymentHistory() |
.paymentHistory.getHistory() |
.getPaymentHistoryTotal() |
.paymentHistory.getTotal() |
.getTransaction() |
.paymentHistory.getTransaction() |
.getTransactionCheque() |
.paymentHistory.getTransactionCheque() |
.sendTransactionCheque() |
.paymentHistory.sendTransactionCheque() |
.getAccounts() |
.fundingSources.getAccounts() |
.getAccountOffers() |
.fundingSources.getAccountOffers() |
.createAccount() |
.fundingSources.createAccount() |
.setDefaultAccount() |
.fundingSources.setDefaultAccount() |
.getCommission() |
.payments.getCommission() |
.createFormUrl() |
.payments.createFormUrl() |
.pay2() |
.payments.pay() |
.createP2PKeyPair() |
.bills.createP2PKeyPair() |
.createOauthToken() |
.createOauthToken() |
.getCards() |
.cards.get() |
.blockCard() |
.cards.block() |
.unblockCard() |
.cards.unblock() |
.getCardRequisites() |
.cards.getRequisites() |
.renameCard() |
.cards.rename() |
.addWebHook() |
.webhooks.add() |
.removeWebHook() |
.webhooks.remove() |
.getWebHookSecret() |
.webhooks.getSecret() |
.getNewWebHookSecret() |
.webhooks.updateSecret() |
.getActiveWebHook() |
.webhooks.getActiveWebhook() |
.testActiveWebHook() |
.webhooks.testActiveWebhook() |
.checkWebHookSign() |
.webhooks.checkSign() |
.webhookKey |
.webhooks.keys |
.hookId |
.webhooks.activeId |
Параметр wallet
во всех методах удалён. Он был добавлен для
совместимости с версией 1, но так как у 1 кошелька может быть
только 1 валидный walletId
(номер телефона) номер телефона
теперь должен передаваться при создании.
Старый способ вызова |
Новый способ вызова |
new P2P(secretKey, publicKey?) |
P2p.create(secretKey, publicKey?) |
.createBill() |
.bills.create() |
.createBillFormUrl() |
.bills.createFormUrl() |
.getBillStatus() |
.bills.getStatus() |
.billStatus() |
.bills.getStatus() |
.rejectBill() |
.bills.reject() |
Старый способ вызова |
Новый способ вызова |
new DetectorCompat() (или new Detector() до обновления) |
Detector.create() |
.getPhoneProvider() |
.detectProvider.byPhone() |
.getCardProvider() |
.detectProvider.byCardNumber() |