//
//  OJAPayObject.h
//  HiSports
//
//  Created by luxiaoming on 16/10/14.
//  Copyright © 2016年 com.ouj. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, OJAPayType) {
    OJAPayTypeWeXin = 0,//微信
    OJAPayTypeAli = 1,//支付宝
};



typedef void(^OJAPayCompletion)(OJAPayType payType, NSString *message);








/**
 预支付对象
 */
@interface OJAPayPreOrderModel : NSObject


//微信字段
@property (nonatomic, copy) NSString *appid;
@property (nonatomic, copy) NSString *partnerid;
@property (nonatomic, copy) NSString *prepayid;
@property (nonatomic, copy) NSString *package;
@property (nonatomic, copy) NSString *noncestr;
@property (nonatomic, assign) UInt32 timestamp;
@property (nonatomic, copy) NSString *sign;


//支付宝字段
@property (nonatomic, copy) NSString *orderString;

@end





@interface OJAPayBaseService : NSObject



/**
 需要在appDelegate中的handleOpenUrl中调用
 例子：
 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    if (([url.scheme isEqualToString:OJAWeChatAPPKey] && [url.host isEqualToString:@"pay"])
        || [url.host isEqualToString:@"safepay"]
        || [url.host isEqualToString:@"platformapi"]) {
        return [[OJAPayManager defaultManager] handleOpenUrl:url];
    } else {
        return YES;
    }
 }
 */
- (BOOL)handleOpenUrl:(NSURL *)url;

- (void)payForPreOrder:(OJAPayPreOrderModel *)preOrderModel completion:(OJAPayCompletion)completion;


@end
