首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WePay的Xamarin.iOS绑定

WePay的Xamarin.iOS绑定
EN

Stack Overflow用户
提问于 2016-05-19 08:14:48
回答 2查看 109关注 0票数 0

我正在使用objective sharpie为WePay.iOS软件开发工具包创建一个Xamarin绑定。https://github.com/wepay/wepay-ios

我已经设法构建了APIDefinition.cs和StructsAndEnums.cs文件。但是,当我创建绑定项目时,它没有成功编译。

代码语言:javascript
复制
[Export ("initWithSwipedInfo:")]
    IntPtr Constructor (NSObject swipedInfo);

    // -(instancetype)initWithEMVInfo:(id)emvInfo;
    [Export ("initWithEMVInfo:")]
    IntPtr Constructor (NSObject emvInfo);

我知道我需要将NSOBject更改为正确的数据类型。然而,当我查看Objective C文件时。我真的不知道我应该使用什么数据类型。如果有人能给我指引,我将不胜感激。

Objective-C类

代码语言:javascript
复制
@interface WPPaymentInfo : NSObject
@property (nonatomic, strong, readonly) NSString *firstName;
@property (nonatomic, strong, readonly) NSString *lastName;
@property (nonatomic, strong, readonly) NSString *email;
@property (nonatomic, strong, readonly) NSString *paymentDescription;
@property (nonatomic, readonly) BOOL isVirtualTerminal;
@property (nonatomic, strong, readonly) WPAddress *billingAddress;
@property (nonatomic, strong, readonly) WPAddress *shippingAddress;
@property (nonatomic, strong, readonly) id paymentMethod;
@property (nonatomic, strong, readonly) id swiperInfo;
@property (nonatomic, strong, readonly) id manualInfo;
@property (nonatomic, strong, readonly) id emvInfo;

- (instancetype) initWithSwipedInfo:(id)swipedInfo;
- (instancetype) initWithEMVInfo:(id)emvInfo;
- (instancetype) initWithFirstName:(NSString *)firstName
                      lastName:(NSString *)lastName
                         email:(NSString *)email
                billingAddress:(WPAddress *)billingAddress
               shippingAddress:(WPAddress *)shippingAddress
                    cardNumber:(NSString *)cardNumber
                           cvv:(NSString *)cvv
                      expMonth:(NSString *)expMonth
                       expYear:(NSString *)expYear
               virtualTerminal:(BOOL)virtualTerminal;

- (void) addEmail:(NSString *)email;
@end
EN

回答 2

Stack Overflow用户

发布于 2016-05-19 08:49:56

swipedInfo和emvInfo在内部属于NSMutableDictionary类型。

请参阅here

代码语言:javascript
复制
- (void) handleSwipeResponse:(NSDictionary *) responseData 
{
    NSDictionary *info = @{@"firstName"         : [WPRoamHelper firstNameFromRUAData:responseData],
                           @"lastName"          : [WPRoamHelper lastNameFromRUAData:responseData],
                           @"paymentDescription": pan ? pan : @"",
                           @"swiperInfo"        : responseData
                        };

    WPPaymentInfo *paymentInfo = [[WPPaymentInfo alloc] initWithSwipedInfo:info]; 
}
票数 0
EN

Stack Overflow用户

发布于 2016-06-03 01:58:00

@y2chaits Xamarin运行在Mono之上,它是C#。C#不允许使用相同签名的重载。因此,最好改为创建具体的数据类型。当您更改WPAddress时,您也有类似的想法。

在这种情况下,您可以将一个构造函数设置为NSObject,将第二个构造函数设置为NSDictionary (请参阅此处:https://github.com/dikoga/WePayBinding/blob/master/WePayBinding/ApiDefinition.cs)。你会做得很好的。

但是,这个绑定已经完成了。它正在构建,但它有一个问题(http://forums.xamarin.com/discussion/66446/how-to-get-more-information-when-the-app-crashes)。也许你可以花点功夫来帮助它工作,因为它已经在github上了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37312003

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档