123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- //
- // XYPayAPIManager.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2019/12/23.
- // Copyright © 2019 翟玉磊. All rights reserved.
- //
- #import "XYPayAPIManager.h"
- /// 获取金币充值项目
- static NSString * const RECHARGE_GET_COIN_RECHARGE_ITEMS = @"api-app/v1/recharge/getCoinRechargeItems";
- /// 创建金币充值订单
- static NSString * const RECHARGE_ADD_COIN_RECHARGE_ORDER = @"api-app/v1/recharge/addCoinRechargeOrder";
- /// 创建支付订单
- static NSString * const PAY_ADD_PAY_ORDER = @"api-app/v1/pay/addPayOrder";
- /// 创建苹果支付订单
- static NSString * const PAY_ADD_APPLE_PAY_ORDER = @"api-app/v1/pay/addApplePayOrder";
- /// 获取支付状态
- static NSString * const PAY_GET_PAY_STATUS = @"api-app/v1/pay/getPayStatus";
- /// 加入主播粉丝团
- static NSString * const PAY_FOR_JOIN_FANSTEAM = @"api-app/v1/pay/forJoinFansTeam";
- @implementation XYPayAPIManager
- /// 获取金币充值项目
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getCoinRechargeItemsSuccessHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [RECHARGE_GET_COIN_RECHARGE_ITEMS copy];
- config.instructions = @"获取金币充值项目";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 创建金币充值订单
- /// @param itemId 要充值的项目Id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)addCoinRechargeOrderItemId:(NSString *)itemId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [RECHARGE_ADD_COIN_RECHARGE_ORDER copy];
- config.instructions = @"创建金币充值订单";
- config.requestParameters = @{@"itemId":itemId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 创建支付订单
- /// @param orderId 订单id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)addPayOrderWithOrderId:(NSString *)orderId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [PAY_ADD_PAY_ORDER copy];
- config.instructions = @"创建支付订单";
- config.requestParameters = @{@"orderId":orderId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 效验苹果支付订单
- /// @param orderId 订单id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)addPayOrderWithOrderId:(NSString *)orderId transactionId:(NSString *)transactionId receiptData:(NSString *)receiptData successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [PAY_ADD_APPLE_PAY_ORDER copy];
- config.instructions = @"创建苹果支付订单";
- config.requestParameters = @{@"orderId":orderId, @"transactionId":transactionId, @"receiptData":receiptData};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取支付状态
- /// @param orderId 获取订单状态
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getPayStatusWithOrderId:(NSString *)orderId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [PAY_GET_PAY_STATUS copy];
- config.instructions = @"获取支付状态";
- config.requestType = ZYLNetworkRequestTypeGet;
- config.requestParameters = @{@"orderId":orderId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 加入主播粉丝团
- /// @param anchorUserId 主播id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)forJoinFansTeamWithAnchorUserId:(NSString *)anchorUserId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [PAY_FOR_JOIN_FANSTEAM copy];
- config.instructions = @"加入主播粉丝团";
-
- config.requestParameters = @{@"anchorUserId":anchorUserId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- @end
|