123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // CartVM.m
- // Asteria
- //
- // Created by 王猛 on 2024/1/26.
- //
- #import "CartVM.h"
- @implementation CartVM
- - (void)ry_respnsSucessWithPath:(NSString *)mark data:(id)data reqNetType:(ReqNetType)reqNetType{
- if([mark isEqualToString:Cart_cartsMineTotals]){
- CartTotalsM *model = [CartTotalsM mj_objectWithKeyValues:data];
- if(model.extension_attributes){
- model.currency_symbol = model.extension_attributes[@"currency_symbol"];
- model.cart_id = model.extension_attributes[@"cart_id"];
- }
- if(model.items.count>0){
- for(CartTotalsItemsM *item in model.items){
- if(item.extension_attributes){
- NSDictionary *tepDic = [FTT_Helper dictionaryWithJsonString:item.extension_attributes[@"mposc"]];
- item.image = tepDic[@"image"];
- item.initial_price = tepDic[@"initial_price"];
- item.product_id = tepDic[@"product_id"];
- item.currency_symbol = model.currency_symbol;
- if([item.name hasPrefix:@"FREE"]){
- item.isGift = YES;
- }else{
- item.isGift = NO;
- }
- }
- }
- }
- NSMutableArray *ary = [NSMutableArray arrayWithArray:@[model]];
- [self ry_VMconfigDelegateData:data parseAry:ary success:YES mark:mark reqNetType:reqNetType];
- } else if ([mark isEqualToString:Chectout_getPaymentMode]) {
-
- NSArray *paymentArray = [ASCheckoutPaymentModel mj_objectArrayWithKeyValuesArray:data];
- for (int i = 0; i < paymentArray.count; i++) {
- ASCheckoutPaymentModel *payModel = [paymentArray objectAtIndex:i];
- if (i == 0) {
- payModel.isSelect = YES;
- } else {
- payModel.isSelect = NO;
- }
- }
- NSMutableArray *ary = [NSMutableArray arrayWithArray:paymentArray];
- [self ry_VMconfigDelegateData:data parseAry:ary success:YES mark:mark reqNetType:reqNetType];
-
- } else{
- [self ry_VMconfigDelegateData:data parseAry:[NSMutableArray array] success:YES mark:mark reqNetType:reqNetType];
- }
- }
- @end
|