CNISDKPaylevenKit 4.1.37

CNISDKPaylevenKit 4.1.37

由以下成员维护:David HennerShengHua WuVincent Jacquessonconichi iOS 开发者Joseph Tseng



 
依赖
CNISDKCoreKit= 4.1.37
CNISDKPaymentKit= 4.1.37
PaylevenFramework~> 1.0
 

  • conichiGMBH

conichiiOS SDK

Requires Carthage compatible CocoaPods Compatible Build Status

元信息

概述

conichiSDK for iOS 是一种通过低功耗蓝牙(BLE)识别信标周围用户的应用程序。作为一个软件即服务(SaaS)解决方案,conichi 的功能主要集中在个人客人识别、快速登记、启用移动支付(从而结账)、识别个人喜好和奖励忠诚度。

套件

conichiSDK 遵循将功能拆分为不同模块(即所谓的 kit)的思想,现在有 6 个模块可供使用。

开始使用

安装

作为框架安装

要使用 Conichi SDK,请转到 版本页面,下载 Frameworks.zip。解压zip文件,将所有框架拖放到 项目目标 -> 通用 -> 嵌入式二进制文件

Alt text

通过CocoaPods安装

使用 CocoaPods 集成 CNISDKCoreKit 是首选方式。将以下行添加到你的 Podfile

source '[email protected]:CocoaPods/Specs.git'

use_frameworks!

target 'your_tagret' do
  pod 'CNISDKCoreKit'
end

运行 pod install,现在你应该有最新的 CNISDKCoreKit 版本了。

通过Carthage安装

通过Carthage集成 CNISDKCoreKit,请将以下行添加到你的 Cartfile

github "conichiGMBH/conichi-ios-sdk"

运行 carthage update,现在你应该在Carthage文件夹中有最新的 CNISDKCoreKit 版本了。

部分安装

在以下链接中,你可以找到“开始使用”部分如何安装特定 kit 的说明

更新Info.plist文件

然后,你必须将 NSLocation 键添加到你的项目 Info.plist 中,包含要提示用户的消息。

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationAlwaysUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>
<key>NSLocationWhenInUseUsageDescription</key>
 <string>This app needs your location so you can be recognized in conichi Hotels</string>

请注意,如果你决定不使用所有键,则应用程序可能无法正常工作。如果你想知道为什么这些键是必需的,你可以查看 此链接

如果你将要使用我们的 开发预发布 环境,你需要在你的 info.plist 中添加以下行

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
</dict>

启用某些功能

Conichi非常注重安全,因此SDK将授权信息存储在iOS Keychain中,但为了能够在SDK未运行时读写值,iOS系统需要启用Keychain Sharing功能。

目标 -> 功能 -> Keychain Sharing - 打开开关.

Alt text

初始化

以下示例显示了针对指向我们开发服务器的conichiSDK CoreKit的最简单的设置。

Objective-C
  //Create a configuration for the sdk instance
  CNISDKConfiguration *configuration = [CNISDKConfiguration configurationWithBlock:^(id<CNISDKMutableConfiguration> \_Nonnull mutableConfiguration) {
    mutableConfiguration.logLevel = CNISDKLogLevelInfo;
    mutableConfiguration.apiKey = @"your-api-key";
    mutableConfiguration.apiSecret = @"your-api-secret";
    mutableConfiguration.kits = @[ ];
    mutableConfiguration.environment = CNISDKEnvironmentDevelopment;
  }];

  //Setups the sdk delegate - it can be any object that conforms to CNISDKDelegate protocol
  id<CNISDKDelegate> delegate = [self yourMethodToSetupSDKDelegate];

  //Start the sdk with the given configuration
  [CNISDK startWithConfiguration:configuration delegate:delegate];
Swift
  //Create configuration for the sdk instance
  let config: CNISDKConfiguration = CNISDKConfiguration() {
    (mutableConfig: CNISDKMutableConfiguration) in
    mutableConfig.logLevel = CNISDKLogLevel.info
    mutableConfig.apiKey = "your-api-key"
    mutableConfig.apiSecret = "your-api-secret"
    mutableConfig.kits = []
    mutableConfig.environment = CNISDKEnvironment.development
  }

  //Setups the sdk delegate - make sure that you conform to the CNISDKDelegate protocol
  let delegate: CNISDKDelegate = self

  //Start the sdk with given configuration
  CNISDK.start(with: config, delegate: delegate)

在此设置完成后,在Obj-C中使用[CNISDK sharedInstance]或在Swift中使用CNISDK.sharedInstance()访问实例。

授权

要开始任何实际操作,需要通过sdk对客户进行授权。所有与授权相关的函数都在CNISDKAPIManager+Authentication类别中。以下示例显示了如何对新客户进行注册。

Objective-C
//Create a sign up request
CNISDKSignUpRequestInfo *info = [[CNISDKSignUpRequestInfo alloc] init];
info.firstName = @"Jenessa";
info.lastName = @"Gretta";
info.email = @"[email protected]";
info.password = @"strongestpasswordever=)";

//Perform sign up
[CNISDKAPIManager manager] signUpWithRequest:info completion:^(CNISDKGuest *guest, NSError *error){
  	if (error) {
    	//handle error during the sign up
    }
    else {
     	//handle authorized guest
	}
}];
Swift
// Create a signup request
let info = CNISDKSignUpRequestInfo()
info.firstName = "Jenessa"
info.lastName = "Gretta"
info.email = "[email protected]"
info.password = "strongestpasswordever=)"

// Instantiate APImanager
let apiManager = CNISDKAPIManager()

// Perform signup
apiManager.signUp(withRequest: info) {
  	(guest, error) in
  	if let error = error {
    	//handle error during the sign up
    	return
  	}
  	//handle authorized guest
}

您还可以使用CNISDKExternalSignUpRequestInfo对象来提供外部ID,而不是使用电子邮件密码组合,并通过使用- (void)signUpWithExternalIDRequestInfo:(CNISDKExternalSignUpRequestInfo *)requestInfo completion:(nullable CNISDKGuestErrorBlock)completion; 进行注册。

监控

如果客户已授权,以下代码将启动信标监控

Objective-C

[[CNISDK sharedInstance] startMonitoring];

Swift

CNISDK.sharedInstance().startMonitoring()

现在,当客户接近conichi信标时,应触发以下回调

- (void)conichiSDKDidDiscoverVenue:(CNISDKVenue *)venue;

根据场景不同,可能会有不同的回调被调用。所有回调都可以在CNISDKDelegate.h中找到。

Trackins

Trackins可以被访客在进入某个地点的beacon区域时创建。可以通过Web API获取Trackins。

商家应用可以使用Trackins显示beacon区域附近用户列表。

以下代码展示了在发现地点后如何启动Trackins

Objective-C
- (void)conichiSDKDidDiscoverVenue:(CNISDKVenue *)venue {
	// Get the region ID
    NSString *regionID = venue.regions.firstObject.conichiID;

	// Start tracking guest in region
    [[CNISDKAPIManager manager] startTrackingGuestInRegionWithID:regionID completion:^(id trackin, NSError *error) {
        if error {
            // Handle error
        } else {
            // Do something with trackin
        }
    }];
}
Swift
func conichiSDKDidDiscover(_ venue: CNISDKVenue) {
	// Get the region ID
  	guard let regionID = currentVenue?.regions?.first?.conichiID else {
    	return
  	}

	// Instantiate API Manager if needed
	let apiManager = CNISDKAPIManager()

	// Start tracking guest in region
  	apiManager.startTrackingGuestInRegion(withID: regionID) { (trackin, error) in
 	   	if let unwrappedError = error {
    	  	// Handle error
    	} else {
      		// Do something with trackin
    	}
  	}
}

Checkins

Checkins与地点相关联。它们允许用户执行与地点相关的不同操作,如支付或收到来自地点的消息。Checkins可以通过Web API手动创建,或通过PMS集成自动创建。

退房请求

退房请求允许客人请求关闭他们的登机检查(退房)。它们可以包含或不包含交付物品(如迷你吧物品等需要支付的物品)。

与Checkins一样,它们与地点相关联。它们可以使用SDK创建,并通过Web API获取。

以下示例展示了如何使用CNISDKCoreKit为客人做出没有任何交付物品的退房请求

Objective-C
// Get the guest's credit card
CNISDKCreditCard *creditCard = guest.creditCards.firstObject;

// Create checkout request
[[CNISDKAPIManager manager] createCheckoutRequestWithDeliverableCountableItems:nil selectedCreditCard:creditCard completion:^(id checkoutRequest, NSError *error) {
  	if (error) {
    	// Handle error
  	} else {
    	// Do something with checkoutRequest
  	}
}];
Swift
// Get the guest's credit card
let creditCard = guest.creditCards.first

// Instantiate API Manager if needed
let apiManager = CNISDKAPIManager()

// Create checkout request
apiManager.createCheckoutRequest(with: nil, selectedCreditCard: creditCard.conichiID ) { (checkoutRequest, error) in
	if error {
    	// Handle error
  	} else {
    	// Do something with checkoutRequest
  	}
}

获取客人的状态

您可以使用以下代码从conichi云中获取客人。

Objective-C
// Fetch guest status
[[CNISDK sharedInstance] fetchGuestStatus];
// Implement delegate method of CNISDKDelegate
- (void)conichiSDKDidUpdateGuestStatus:(CNISDKGuest *)guest {
    // do something with guest
}
Swift
// Fetch guest status
CNISDK.sharedInstance().fetchGuestStatus()
// Implement delegate method of CNISDKDelegate
func conichiSDKDidUpdateGuestStatus(_ guest: CNISDKGuest) {
	// do something with guest
}

备注

虽然上述文档应该足以让您开始,但它只涵盖了SDK功能的一小部分。如果您对该使用有任何问题,请随时联系我们。


文档

每个套件的文档可在以下链接中找到

有关推送通知集成的文档可在此处找到

变更日志

要查看 conichiSDK 的最近版本更改,请参阅 变更日志

许可

Copyright (c) 2016-present, сonichi GmbH.
All rights reserved.