//
// JavaAppAjaxDo.m
// Project
//
// Created by ziv on 2017/8/24.
//
//

#import "JavaAppAjaxDo.h"
#import "Lang.h"
#import "CocoaUtils.h"
#import "Vars.h"

@implementation JavaAppAjaxDo

#pragma mark - Protected

- (NSString *)endpoint {
	return [Vars javaAppEndpoint];
}

- (NSString *)address {
	return [NSString stringWithFormat:@"%@/do/ajax/%@/%@", self.endpoint, self.namespace, self.name];
}

- (NSString *)name {
	NSString *className = NSStringFromClass(self.class);
	return [className stringByReplacingOccurrencesOfString:@"[A-Z]" withString:@"-$0" options:NSRegularExpressionSearch range:NSMakeRange(1, className.length - 1)].lowercaseString;
}

- (NSString *)namespace {
	NSString *superclassName = NSStringFromClass(self.superclass);
	NSString *string = nil;
	string = [superclassName substringToIndex:superclassName.length - @"AjaxDo".length];
	string = [string stringByReplacingOccurrencesOfString:@"[A-Z]" withString:@"-$0" options:NSRegularExpressionSearch range:NSMakeRange(1, string.length - 1)];
	return string.lowercaseString;
}

@end

@implementation ThirdPartyPaymentAjaxDo
@end

@implementation GetPaymentState

- (NSString *)endpoint {
	NSString *endpoint = [super endpoint];
	if (![StringUtils isEmpty:self.paymentId] && [endpoint containsString:@"www.taketours.cn"]) {
		endpoint = [endpoint stringByReplacingOccurrencesOfString:@"www.taketours.cn" withString:@"www.taketours.com"];
	}
	return endpoint;
}

@end

@implementation GetPaymentStateResponse
@end
