.. meta:: :description: mPOS SDK SBC для iOS: интеграция транзакций с предъявлением карты в приложение для iPhone или iPad с Bluetooth-считывателями карт, чипом EMV и бесконтактными сценариями. .. _mpos_sdk_for_ios: Описание: mPOS SDK for iOS ################ .. role:: ex .. role:: code Введение ------------ SBC mPOS SDK — это программно-аппаратный комплекс мобильных платежей, позволяющий быстро и легко начать предоставлять сервис мобильных платежей. Использование доступного мобильного POS-терминала (mPOS) позволяет Присоединяющейся Стороне расширить свой бизнес за счёт очных безналичных платежей. .. uml:: :align: center @startuml left to right direction rectangle "Mobile Device" { (mPOS SDK) #ffe6cc;line:black;line.dotted (Mobile App) } (SBC) -- (mPOS SDK) (SBC) - (Acquirer Bank) (mPOS SDK) -- (Mobile App) (mPOS device) - (mPOS SDK) @enduml SDK PayneteasyReader обеспечивает быструю интеграцию, соответствующую ADVT и M-TIP, с терминалами :ref:`mPOS` в мобильных приложениях. SDK включает заголовочные файлы и одну статическую библиотеку. Поддерживаемые терминалы ------------------------ .. list-table:: :widths: 30, 50, 50 :header-rows: 1 :class: longtable * - Производитель - Модель - Подключение * - Miura - M006, M007, M010 - Bluetooth, USB, Wi-Fi * - Spire - SPm2, SPm20 - Bluetooth * - Verifone - Vx820 - Ethernet, USB, RS232 * - PAX - SP30, D200 - Ethernet, USB, RS232 .. note:: | Требования: PayneteasyReader SDK поддерживает целевое развёртывание на iOS версии 7.0+ и набор команд armv7+ (включая 64-бит), x86_64, i386 (для эмулятора). Интеграционная среда ----------- Добавьте SDK в проект ========================== Добавьте следующее в Podfile: :: pod "PayneteasyReader", :git => 'git@github.com:evsinev/PayneteasyReader.git', :tag => '$VERSION' Измените :code:`$VERSION` на последнюю версию из списка релизов для |ios_link| или |android_link| соответственно. .. |ios_link| raw:: html IOS .. |android_link| raw:: html Android Для Miura, Spire и Pax ======================== Добавьте следующее в \*-Info.plist: :: UISupportedExternalAccessoryProtocols com.miura.shuttle com.thyron com.paxsz.ipos Пример кода =========== Реализуйте протокол PNEReaderPresenter: :: - (void)stateChanged:(PNEReaderEvent *)aEvent { // displays reader status // see an example at https://github.com/payneteasy/ReaderExample/blob/master/ReaderExample/PaymentModule/PaymentPresenter.m#L69 } - (PNEProcessingContinuation *)onCard:(PNECard *)aCard { // provide payneteasy.com account info PNEProcessingContinuation * continuation = [PNEProcessingContinuation continuationWithBaseUrl:@"https://sandbox.payneteasy.com/paynet" merchantLogin:MERCHANT_LOGIN merchantKey:MERCHANT_KEY merchantEndPointId:END_POINT_ID orderInvoiceNumber:[[NSUUID UUID] UUIDString]]; return continuation; } - (void)onCardError:(PNECardError *)aError { // deal with the error // see an example at https://github.com/payneteasy/ReaderExample/blob/master/ReaderExample/PaymentModule/PaymentPresenter.m#L93 } - (void)onProcessingEvent:(PNEProcessingEvent *)aEvent { // wait for Result event // see an example at https://github.com/payneteasy/ReaderExample/blob/master/ReaderExample/PaymentModule/PaymentPresenter.m#L96 } - (PNEConfigurationContinuation *)onConfiguration { return [[PNEConfigurationContinuation alloc] initWithBaseUrl:@"https://paynet-qa.clubber.me/paynet/rki" merchantLogin:_payment.merchantLogin merchantKey:_payment.merchantKey merchantEndPointId:_payment.merchantEndPointId merchantName:_payment.merchantName ]; } Start Reader Manager: :: PNEReaderFactory *factory = [[PNEReaderFactory alloc] init]; PNEReaderInfo *reader = [PNEReaderInfo infoWithType:PNEReaderType_MIURA_OR_SPIRE]; // Note: manager must be a property or a field or a static local variable, to prevent an elimination manager = [factory createManager:reader amount:[NSDecimalNumber decimalNumberWithString:@"1.00"] currency:@"RUB" presenter:self]; [manager start]; Полезные ссылки ============================================= - `Objective-C с Cocoapods `__ - `Swift с Cocoapods `__ - `Swift с Carthage `__ - Дополнительные примеры предоставляются по запросу. - Другие выпуски можно найти `здесь `__. Test Environment ================== .. list-table:: :widths: 30, 50, 50 :header-rows: 1 :class: longtable * - Сумма - Статус - Stage * - 1.00 - APPROVED - Purchase, Final Advice * - 2.00 - DECLINED - Purchase * - 3.00 - APPROVED - Purchase * - 4.00 - DECLINED - Purchase, Final Advice * - 1000.01 - APPROVED - Покупка, Final Advice с тестом PIN Online. :ex:`В тестовых целях можно использовать только тестовые карты.` .. note:: | Описание: Any card can be used. | Если карта запрашивает ARQC, хост отвечает с Authorisation Response Code = 'Z3' (невозможно перейти в онлайн, отклонено офлайн).