diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2393aaf --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# Autosave files +*~ + +# build +[Oo]bj/ +[Bb]in/ +packages/ +TestResults/ + +# globs +Makefile.in +*.DS_Store +*.sln.cache +*.suo +*.cache +*.pidb +*.userprefs +*.usertasks +config.log +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.user +*.tar.gz +tarballs/ +test-results/ +Thumbs.db + +# Mac bundle stuff +*.dmg +*.app + +# resharper +*_Resharper.* +*.Resharper + +# dotCover +*.dotCover +*.nupkg diff --git a/KountDataCollector/ApiDefinitions.cs b/KountDataCollector/ApiDefinitions.cs new file mode 100644 index 0000000..7e00616 --- /dev/null +++ b/KountDataCollector/ApiDefinitions.cs @@ -0,0 +1,54 @@ +using System; +using Foundation; +using ObjCRuntime; + +namespace Kount +{ + [Static] + [Verify (ConstantsInterfaceAssociation)] + partial interface Constants + { + // extern NSString *const _Nonnull KDataCollectorErrorDomain; + [Field ("KDataCollectorErrorDomain", "__Internal")] + NSString KDataCollectorErrorDomain { get; } + + // extern NSString *const _Nonnull KDataCollectorVersion; + [Field ("KDataCollectorVersion", "__Internal")] + NSString KDataCollectorVersion { get; } + } + + // @interface KDataCollector : NSObject + [BaseType (typeof(NSObject))] + interface KDataCollector + { + // +(KDataCollector * _Nonnull)sharedCollector; + [Static] + [Export ("sharedCollector")] + [Verify (MethodToProperty)] + KDataCollector SharedCollector { get; } + + // @property NSInteger merchantID; + [Export ("merchantID")] + nint MerchantID { get; set; } + + // @property KLocationCollectorConfig locationCollectorConfig; + [Export ("locationCollectorConfig", ArgumentSemantic.Assign)] + KLocationCollectorConfig LocationCollectorConfig { get; set; } + + // @property BOOL debug; + [Export ("debug")] + bool Debug { get; set; } + + // @property NSInteger timeoutInMS; + [Export ("timeoutInMS")] + nint TimeoutInMS { get; set; } + + // @property KEnvironment environment; + [Export ("environment", ArgumentSemantic.Assign)] + KEnvironment Environment { get; set; } + + // -(void)collectForSession:(NSString * _Nonnull)sessionID completion:(void (^ _Nullable)(NSString * _Nonnull, BOOL, NSError * _Nullable))completionBlock; + [Export ("collectForSession:completion:")] + void CollectForSession (string sessionID, [NullAllowed] Action completionBlock); + } +} diff --git a/KountDataCollector/KDataCollector.h b/KountDataCollector/KDataCollector.h new file mode 100755 index 0000000..d73d075 --- /dev/null +++ b/KountDataCollector/KDataCollector.h @@ -0,0 +1,104 @@ +// +// KDataCollector.h +// Kount Data Collector SDK +// +// Copyright © 2016 Kount Inc. All rights reserved. +// + +#import + +// Error Codes +typedef NS_ENUM(NSInteger, KDataCollectorErrorCode) { + + KDataCollectorErrorCodeUnknown = 0, + + // A system error occurred + KDataCollectorErrorCodeNSError, + + // A required collector timed out + KDataCollectorErrorCodeTimeout, + + // A bad parameter was passed into the data collector + KDataCollectorErrorCodeBadParameter, + + // A network connection isn't available + KDataCollectorErrorCodeNoNetwork, + + // An error occurred while validating a response from the server + KDataCollectorErrorCodeResponseValidation, +}; + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const KDataCollectorErrorDomain; + +// Version of the Kount Data Collector SDK +extern NSString *const KDataCollectorVersion; + +// Configuration settings for location collection +typedef NS_ENUM(NSInteger, KLocationCollectorConfig) { + + // Request permission if not currently authorized (default) + KLocationCollectorConfigRequestPermission = 0, + + // Only collect if app already has location permissions + // (use in cases where requesting permission is done by the app itself) + KLocationCollectorConfigPassive, + + // Skip location collection + KLocationCollectorConfigSkip, +}; + +// Configuration settings Kount collection environment +typedef NS_ENUM(NSInteger, KEnvironment) { + + // Unknown Environment + KEnvironmentUnknown = 0, + + // Test Environment + KEnvironmentTest, + + // Production Environment + KEnvironmentProduction, +}; + +// KDataCollector enables you to collect device information for the given session +// +// First, configure the collector during the initialization of your application +// Second, call collectForSession when you start the payment checkout process +// +@interface KDataCollector : NSObject + +// Get the shared instance of the Data Collector ++ (KDataCollector *)sharedCollector; + +// +// Configuration +// + +// The Kount Merchant ID +@property NSInteger merchantID; +// The configuration of the location collector to determine if and how it goes about collection location +@property KLocationCollectorConfig locationCollectorConfig; +// Debug logging to the console +@property BOOL debug; +// Timeout in MS for the collection +@property NSInteger timeoutInMS; +// The Kount environment +@property KEnvironment environment; + +// +// Collection +// + +// Collect data for the session. +// +// @param sessionID A unique session ID that should match the sessionID for the payment transaction +// @param completionBlock This completion block will be called when the collection has completed or an error occurs. +- (void)collectForSession:(NSString *)sessionID completion:(nullable void (^)(NSString *_Nonnull sessionID, BOOL success, NSError *_Nullable error))completionBlock; + +NS_ASSUME_NONNULL_END + +@end + + diff --git a/KountDataCollector/StructsAndEnums.cs b/KountDataCollector/StructsAndEnums.cs new file mode 100644 index 0000000..b6bd326 --- /dev/null +++ b/KountDataCollector/StructsAndEnums.cs @@ -0,0 +1,32 @@ +using System; +using ObjCRuntime; + +namespace Kount +{ + [Native] + public enum KDataCollectorErrorCode : nint + { + Unknown = 0, + NSError, + Timeout, + BadParameter, + NoNetwork, + ResponseValidation + } + + [Native] + public enum KLocationCollectorConfig : nint + { + RequestPermission = 0, + Passive, + Skip + } + + [Native] + public enum KEnvironment : nint + { + Unknown = 0, + Test, + Production + } +} diff --git a/KountDataCollector/libKountDataCollector.a b/KountDataCollector/libKountDataCollector.a new file mode 100755 index 0000000..a92cb67 Binary files /dev/null and b/KountDataCollector/libKountDataCollector.a differ diff --git a/Naxam.Kount.iOS/ApiDefinition.cs b/Naxam.Kount.iOS/ApiDefinition.cs new file mode 100644 index 0000000..6f280f7 --- /dev/null +++ b/Naxam.Kount.iOS/ApiDefinition.cs @@ -0,0 +1,40 @@ +using System; +using Foundation; +using ObjCRuntime; + +namespace Kount +{ + // @interface KDataCollector : NSObject + [BaseType (typeof(NSObject))] + interface KDataCollector + { + // +(KDataCollector * _Nonnull)sharedCollector; + [Static] + [Export ("sharedCollector")] + KDataCollector SharedCollector { get; } + + // @property NSInteger merchantID; + [Export ("merchantID")] + nint MerchantID { get; set; } + + // @property KLocationCollectorConfig locationCollectorConfig; + [Export ("locationCollectorConfig", ArgumentSemantic.Assign)] + KLocationCollectorConfig LocationCollectorConfig { get; set; } + + // @property BOOL debug; + [Export ("debug")] + bool Debug { get; set; } + + // @property NSInteger timeoutInMS; + [Export ("timeoutInMS")] + nint TimeoutInMS { get; set; } + + // @property KEnvironment environment; + [Export ("environment", ArgumentSemantic.Assign)] + KEnvironment Environment { get; set; } + + // -(void)collectForSession:(NSString * _Nonnull)sessionID completion:(void (^ _Nullable)(NSString * _Nonnull, BOOL, NSError * _Nullable))completionBlock; + [Export ("collectForSession:completion:")] + void CollectForSession (string sessionID, [NullAllowed] Action completionBlock); + } +} diff --git a/Naxam.Kount.iOS/Naxam.Kount.iOS.csproj b/Naxam.Kount.iOS/Naxam.Kount.iOS.csproj new file mode 100644 index 0000000..91eccf7 --- /dev/null +++ b/Naxam.Kount.iOS/Naxam.Kount.iOS.csproj @@ -0,0 +1,50 @@ + + + + Debug + AnyCPU + {552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E} + {8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Naxam.Kount.iOS + Naxam.Kount.iOS + Resources + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + prompt + 4 + true + + + + + + + + + + + + + + + + + Static + False + + + + \ No newline at end of file diff --git a/Naxam.Kount.iOS/Properties/AssemblyInfo.cs b/Naxam.Kount.iOS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d5955c0 --- /dev/null +++ b/Naxam.Kount.iOS/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +using Foundation; + +// This attribute allows you to mark your assemblies as “safe to link”. +// When the attribute is present, the linker—if enabled—will process the assembly +// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds. + +[assembly: LinkerSafe] + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Naxam.Kount.iOS")] +[assembly: AssemblyDescription("Xamarin Binding Library - Kount iOS SDK")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("NAXAM COMPANY LIMITED")] +[assembly: AssemblyProduct("X Bindings")] +[assembly: AssemblyCopyright("Copyright (c) 2017 NAXAM")] +[assembly: AssemblyTrademark("NAXAM")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("3.1.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/Naxam.Kount.iOS/Structs.cs b/Naxam.Kount.iOS/Structs.cs new file mode 100644 index 0000000..24d7c25 --- /dev/null +++ b/Naxam.Kount.iOS/Structs.cs @@ -0,0 +1,32 @@ +using System; +using ObjCRuntime; + +namespace Kount +{ + [Native] + public enum KDataCollectorErrorCode : long + { + Unknown = 0, + NSError, + Timeout, + BadParameter, + NoNetwork, + ResponseValidation + } + + [Native] + public enum KLocationCollectorConfig : long + { + RequestPermission = 0, + Passive, + Skip + } + + [Native] + public enum KEnvironment : long + { + Unknown = 0, + Test, + Production + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f39d1a --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Xamarin Binding Library - Kount iOS SDK +https://github.com/Kount/kount-ios-sdk + +``` +Install-Package Naxam.Kount.iOS +``` \ No newline at end of file diff --git a/kount-ios.sln b/kount-ios.sln new file mode 100644 index 0000000..5d4d35b --- /dev/null +++ b/kount-ios.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Naxam.Kount.iOS", "Naxam.Kount.iOS\Naxam.Kount.iOS.csproj", "{552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {552FBFA1-75F9-44A6-8A2F-98CBE6FE4E5E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/kount.nuspec b/kount.nuspec new file mode 100644 index 0000000..d2ba0dd --- /dev/null +++ b/kount.nuspec @@ -0,0 +1,23 @@ + + + + + Naxam.Kount.iOS + 3.1 + Xamarin Binding Library - Kount iOS SDK + Vu Duc Tuyen + NAXAM CO.,LTD + false + Naxam - Kount iOS SDK + Kount iOS SDK v3.1 + Xamarin Binding Library - Kount iOS SDK + https://opensource.org/licenses/MIT + https://github.com/NAXAM/kount-ios-binding + Copyright (c) 2017 NAXAM + Xamarin.iOS, kount + + + + + + \ No newline at end of file