85 lines
3.1 KiB
Objective-C
85 lines
3.1 KiB
Objective-C
//
|
|
// YMMineRechargePresenter.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2021/9/24.
|
|
//
|
|
|
|
#import "XPMineRechargePresenter.h"
|
|
///Api
|
|
#import "Api+Mine.h"
|
|
///Tool
|
|
#import "AccountInfoStorage.h"
|
|
#import "YYUtility.h"
|
|
#import "NSObject+MJExtension.h"
|
|
///P
|
|
#import "XPMineRechargeProtocol.h"
|
|
///Model
|
|
#import "RechargeListModel.h"
|
|
#import "WalletInfoModel.h"
|
|
|
|
@implementation XPMineRechargePresenter
|
|
|
|
|
|
/// 获取钱包信息
|
|
- (void)getUserWalletInfo {
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
[Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data];
|
|
[[self getView] getUserWalletInfo:model];
|
|
}] uid:uid ticket:ticket];
|
|
}
|
|
|
|
|
|
/// 请求内购列表
|
|
/// @param channel 目前是8
|
|
- (void)requestRechargeListWithChannel:(NSString *)channel {
|
|
[Api getRechargeList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSArray * array = [RechargeListModel modelsWithArray:data.data];
|
|
[[self getView] requestRechargeListSucccess:array];
|
|
}] channelType:channel];
|
|
}
|
|
|
|
/// 获取充值的订单编号
|
|
/// @param chargeProdId 苹果服务器的充值 的id
|
|
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
NSString * deviceInfo = [YYUtility deviceID];
|
|
NSString * clientIp= [YYUtility ipAddress];
|
|
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
NSString *orderId = (NSString *)data.data[@"recordId"];
|
|
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
|
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView] requestIAPRechargeOrderFail];
|
|
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
|
}
|
|
|
|
|
|
/// 充值成功二次验证
|
|
/// @param orderId 订单编号
|
|
/// @param transcationId 商品id
|
|
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
[[self getView] checkReceiptSuccess:transcationId];
|
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
[[self getView]checkReceiptFailWithCode:code transcationId:transcationId];
|
|
} showLoading:NO errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
|
}
|
|
|
|
|
|
/// 批量验证内购掉单
|
|
/// @param transcations 凭据的数组
|
|
- (void)checkTranscationIds:(NSArray *)transcations {
|
|
NSString * transcationIdStr = [transcations toJSONString];
|
|
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
[[self getView] checkTranscationIdsSuccess];
|
|
}] transcationIdStr:transcationIdStr];
|
|
}
|
|
|
|
@end
|