Commit 68a4164f by lee

u

parents da41cff9 534c3f10
......@@ -93,6 +93,18 @@
C02C7DA81E66B2AE008DC29C /* KWMFilterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C02C7DA61E66B2AE008DC29C /* KWMFilterCell.xib */; };
C02C7DB41E67B56D008DC29C /* KWMFilterHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = C02C7DB21E67B56D008DC29C /* KWMFilterHeaderView.m */; };
C02C7DB51E67B56D008DC29C /* KWMFilterHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C02C7DB31E67B56D008DC29C /* KWMFilterHeaderView.xib */; };
C03120961EF29A5F00E49EFA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C03120951EF29A5F00E49EFA /* QuartzCore.framework */; };
C03120981EF29A8900E49EFA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C03120971EF29A8900E49EFA /* CoreText.framework */; };
C031209A1EF29A9800E49EFA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C03120991EF29A9800E49EFA /* CoreGraphics.framework */; };
C031209C1EF29AA400E49EFA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C031209B1EF29AA400E49EFA /* UIKit.framework */; };
C031209E1EF29ABE00E49EFA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C031209D1EF29ABE00E49EFA /* Foundation.framework */; };
C03120A01EF29AF200E49EFA /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C031209F1EF29AF200E49EFA /* CoreMotion.framework */; };
C03120A51EF29B2900E49EFA /* AlipaySDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = C03120A21EF29B2900E49EFA /* AlipaySDK.bundle */; };
C03120A61EF29B2900E49EFA /* AlipaySDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C03120A31EF29B2900E49EFA /* AlipaySDK.framework */; };
C03120A71EF29B2900E49EFA /* 更新日志.txt in Resources */ = {isa = PBXBuildFile; fileRef = C03120A41EF29B2900E49EFA /* 更新日志.txt */; };
C03120AA1EF2AC5A00E49EFA /* KWMWechatPayData.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120A91EF2AC5A00E49EFA /* KWMWechatPayData.m */; };
C03120AD1EF2AC6700E49EFA /* KWMCheckoutPayResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */; };
C03120B01EF2B26B00E49EFA /* KWMPayUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */; };
C032D3041DD87E07008D3155 /* KWMImagesResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3031DD87E07008D3155 /* KWMImagesResult.m */; };
C032D3071DD87E5F008D3155 /* KWMImage.m in Sources */ = {isa = PBXBuildFile; fileRef = C032D3061DD87E5F008D3155 /* KWMImage.m */; };
C034E68F1D6AEB12006EE129 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C034E68E1D6AEB12006EE129 /* main.m */; };
......@@ -448,6 +460,21 @@
C02C7DB11E67B56D008DC29C /* KWMFilterHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterHeaderView.h; sourceTree = "<group>"; };
C02C7DB21E67B56D008DC29C /* KWMFilterHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterHeaderView.m; sourceTree = "<group>"; };
C02C7DB31E67B56D008DC29C /* KWMFilterHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMFilterHeaderView.xib; sourceTree = "<group>"; };
C03120951EF29A5F00E49EFA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
C03120971EF29A8900E49EFA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
C03120991EF29A9800E49EFA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
C031209B1EF29AA400E49EFA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
C031209D1EF29ABE00E49EFA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
C031209F1EF29AF200E49EFA /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
C03120A21EF29B2900E49EFA /* AlipaySDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = AlipaySDK.bundle; sourceTree = "<group>"; };
C03120A31EF29B2900E49EFA /* AlipaySDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlipaySDK.framework; sourceTree = "<group>"; };
C03120A41EF29B2900E49EFA /* 更新日志.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "更新日志.txt"; sourceTree = "<group>"; };
C03120A81EF2AC5A00E49EFA /* KWMWechatPayData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMWechatPayData.h; sourceTree = "<group>"; };
C03120A91EF2AC5A00E49EFA /* KWMWechatPayData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMWechatPayData.m; sourceTree = "<group>"; };
C03120AB1EF2AC6700E49EFA /* KWMCheckoutPayResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCheckoutPayResult.h; sourceTree = "<group>"; };
C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCheckoutPayResult.m; sourceTree = "<group>"; };
C03120AE1EF2B26B00E49EFA /* KWMPayUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMPayUtil.h; sourceTree = "<group>"; };
C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMPayUtil.m; sourceTree = "<group>"; };
C032D3021DD87E07008D3155 /* KWMImagesResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMImagesResult.h; sourceTree = "<group>"; };
C032D3031DD87E07008D3155 /* KWMImagesResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMImagesResult.m; sourceTree = "<group>"; };
C032D3051DD87E5F008D3155 /* KWMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMImage.h; sourceTree = "<group>"; };
......@@ -785,8 +812,14 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C02C7D8E1E6411C3008DC29C /* CFNetwork.framework in Frameworks */,
C02C7D8C1E6411AE008DC29C /* CoreTelephony.framework in Frameworks */,
C03120961EF29A5F00E49EFA /* QuartzCore.framework in Frameworks */,
C03120981EF29A8900E49EFA /* CoreText.framework in Frameworks */,
C031209A1EF29A9800E49EFA /* CoreGraphics.framework in Frameworks */,
C031209C1EF29AA400E49EFA /* UIKit.framework in Frameworks */,
C031209E1EF29ABE00E49EFA /* Foundation.framework in Frameworks */,
C02C7D8E1E6411C3008DC29C /* CFNetwork.framework in Frameworks */,
C03120A01EF29AF200E49EFA /* CoreMotion.framework in Frameworks */,
C02C7D8A1E64119E008DC29C /* Security.framework in Frameworks */,
C02C7D881E64118D008DC29C /* libc++.tbd in Frameworks */,
C02C7D861E641172008DC29C /* libz.tbd in Frameworks */,
......@@ -796,6 +829,7 @@
C02C7D801E640D82008DC29C /* libWeChatSDK.a in Frameworks */,
8045F30E1D94C6BF0042B15A /* libsqlite3.0.tbd in Frameworks */,
80FBF7E18C063DB9E8DC7502 /* libPods-iCemarose.a in Frameworks */,
C03120A61EF29B2900E49EFA /* AlipaySDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -984,9 +1018,21 @@
path = iCemarose/WeChat;
sourceTree = "<group>";
};
C03120A11EF29B2900E49EFA /* Alipay */ = {
isa = PBXGroup;
children = (
C03120A21EF29B2900E49EFA /* AlipaySDK.bundle */,
C03120A31EF29B2900E49EFA /* AlipaySDK.framework */,
C03120A41EF29B2900E49EFA /* 更新日志.txt */,
);
name = Alipay;
path = iCemarose/Alipay;
sourceTree = "<group>";
};
C034E6811D6AEB12006EE129 = {
isa = PBXGroup;
children = (
C03120A11EF29B2900E49EFA /* Alipay */,
C02C7D7A1E640D82008DC29C /* WeChat */,
C034E68C1D6AEB12006EE129 /* iCemarose */,
C034E6A61D6AEB13006EE129 /* iCemaroseTests */,
......@@ -1080,6 +1126,8 @@
C034E6E31D6AEF73006EE129 /* KWMRequestResult.m */,
C03846921DB89EEB008C3BAB /* KWMCemaroseResult.h */,
C03846931DB89EEB008C3BAB /* KWMCemaroseResult.m */,
C03120AB1EF2AC6700E49EFA /* KWMCheckoutPayResult.h */,
C03120AC1EF2AC6700E49EFA /* KWMCheckoutPayResult.m */,
);
path = Api;
sourceTree = "<group>";
......@@ -1087,6 +1135,8 @@
C034E6C21D6AECF9006EE129 /* Model */ = {
isa = PBXGroup;
children = (
C03120A81EF2AC5A00E49EFA /* KWMWechatPayData.h */,
C03120A91EF2AC5A00E49EFA /* KWMWechatPayData.m */,
C091EE311DDB1FC500A382B9 /* KWMAppVersion.h */,
C091EE321DDB1FC500A382B9 /* KWMAppVersion.m */,
C034E6CC1D6AEE20006EE129 /* DAO */,
......@@ -1175,6 +1225,8 @@
9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */,
9B8298E11EF22BE200743438 /* KWMCurrencyUtil.h */,
9B8298E21EF22BE200743438 /* KWMCurrencyUtil.m */,
C03120AE1EF2B26B00E49EFA /* KWMPayUtil.h */,
C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */,
);
path = Util;
sourceTree = "<group>";
......@@ -1846,6 +1898,12 @@
FB61DBBD1842EA19647B37D6 /* Frameworks */ = {
isa = PBXGroup;
children = (
C031209F1EF29AF200E49EFA /* CoreMotion.framework */,
C031209D1EF29ABE00E49EFA /* Foundation.framework */,
C031209B1EF29AA400E49EFA /* UIKit.framework */,
C03120991EF29A9800E49EFA /* CoreGraphics.framework */,
C03120971EF29A8900E49EFA /* CoreText.framework */,
C03120951EF29A5F00E49EFA /* QuartzCore.framework */,
C02C7D9F1E666978008DC29C /* MessageUI.framework */,
C02C7D8D1E6411C3008DC29C /* CFNetwork.framework */,
C02C7D8B1E6411AE008DC29C /* CoreTelephony.framework */,
......@@ -1979,6 +2037,7 @@
C034E8561D6B10A0006EE129 /* CoreSVP.bundle in Resources */,
C034E8591D6B10A0006EE129 /* SVProgressHUD.bundle in Resources */,
801230F31DD30704008C7904 /* KWMSearchBrandsCell.xib in Resources */,
C03120A71EF29B2900E49EFA /* 更新日志.txt in Resources */,
C084F4591D6D976F00A0625D /* KWMSearchBar.xib in Resources */,
C0DD53381EE55190002D1E0C /* KWMLoadingView.xib in Resources */,
C0F586811E24F820001248E2 /* KWMNewTypeView.xib in Resources */,
......@@ -2017,6 +2076,7 @@
8091DFB81D6EC1C60020519C /* KWMThreeView.xib in Resources */,
8091DFB01D6EAD6F0020519C /* KWMSecondView.xib in Resources */,
8091DFA61D6EA0840020519C /* KWMLastView.xib in Resources */,
C03120A51EF29B2900E49EFA /* AlipaySDK.bundle in Resources */,
C034E8601D6B10A0006EE129 /* PB.bundle in Resources */,
C0DD531A1EE54C5F002D1E0C /* KWMSearchFeedBackView.xib in Resources */,
C0DD53151EE54B96002D1E0C /* KWMSearchBrandView.xib in Resources */,
......@@ -2082,7 +2142,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
F84386F9A53E1205C21D5570 /* [CP] Copy Pods Resources */ = {
......@@ -2119,6 +2179,7 @@
C0F5867A1E24F820001248E2 /* KWMDoubleTitleView.m in Sources */,
8091DFBB1D6EC1DD0020519C /* KWMThreeView.m in Sources */,
C0DD53371EE55190002D1E0C /* KWMLoadingView.m in Sources */,
C03120B01EF2B26B00E49EFA /* KWMPayUtil.m in Sources */,
9BE61CFB1ECD56E70031D21E /* KWMDictioaryResult.m in Sources */,
C034E6D81D6AEF1B006EE129 /* KWMImageUtil.m in Sources */,
C03846941DB89EEB008C3BAB /* KWMCemaroseResult.m in Sources */,
......@@ -2175,6 +2236,7 @@
C034E8641D6B10A0006EE129 /* PBScrollView.m in Sources */,
C0D7CAA11EA843AD005AE3A3 /* KWMOrder.m in Sources */,
C0F586781E24F820001248E2 /* KWMDetailCell.m in Sources */,
C03120AD1EF2AC6700E49EFA /* KWMCheckoutPayResult.m in Sources */,
801F87BF1DD1D6850038FA4C /* KWMLoadStatus.m in Sources */,
C03943C31DD1FD3F00141475 /* KWMProductTypeResult.m in Sources */,
804771851D6D585B0086B4DC /* KWMValidationVC.m in Sources */,
......@@ -2209,6 +2271,7 @@
8077F79A1D73E39000A2E2E2 /* KWMBrandCaramelCell.m in Sources */,
9BE61D011ECD71610031D21E /* KWMCartResult.m in Sources */,
C0CCB3C11EEA59A200BC2FB8 /* KWMFilterViewCell.m in Sources */,
C03120AA1EF2AC5A00E49EFA /* KWMWechatPayData.m in Sources */,
C084F4571D6D975400A0625D /* KWMSearchBar.m in Sources */,
C0DD534D1EE6AE06002D1E0C /* BaseCell.m in Sources */,
C0E8AE091D7D030B00C193DC /* KWMEditAddressVC.m in Sources */,
......@@ -2457,6 +2520,10 @@
CODE_SIGN_IDENTITY = "iPhone Developer: Yibo Jia (W6TWSKB7VU)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Yibo Jia (W6TWSKB7VU)";
DEVELOPMENT_TEAM = 72Z44QQ9ZD;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/iCemarose/Alipay",
);
GCC_PREFIX_HEADER = "iCemarose/Header-Prefix.h";
INFOPLIST_FILE = iCemarose/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......@@ -2527,6 +2594,10 @@
CODE_SIGN_IDENTITY = "iPhone Developer: Yibo Jia (W6TWSKB7VU)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Yibo Jia (W6TWSKB7VU)";
DEVELOPMENT_TEAM = 72Z44QQ9ZD;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/iCemarose/Alipay",
);
GCC_PREFIX_HEADER = "iCemarose/Header-Prefix.h";
INFOPLIST_FILE = iCemarose/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
......
//
// APAuthInfo.h
// AliSDKDemo
//
// Created by alipay on 16-12-12.
// Copyright (c) 2016年 Alipay.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface APayAuthInfo : NSObject
@property(nonatomic, copy)NSString *appID;
@property(nonatomic, copy)NSString *pid;
@property(nonatomic, copy)NSString *redirectUri;
/**
* 初始化AuthInfo
*
* @param appIDStr 应用ID
* @param pidStr 商户ID 可不填
* @param uriStr 授权的应用回调地址 比如:alidemo://auth
*
* @return authinfo实例
*/
- (id)initWithAppID:(NSString *)appIDStr
pid:(NSString *)pidStr
redirectUri:(NSString *)uriStr;
- (NSString *)description;
- (NSString *)wapDescription;
@end
//
// AlipaySDK.h
// AlipaySDK
//
// Created by alipay on 16-12-12.
// Copyright (c) 2016年 Alipay. All rights reserved.
//
////////////////////////////////////////////////////////
///////////////// 支付宝标准版本支付SDK ///////////////////
/////////// version:15.3.3 motify:2017.03.07 ///////////
////////////////////////////////////////////////////////
#import "APayAuthInfo.h"
typedef enum {
ALIPAY_TIDFACTOR_IMEI,
ALIPAY_TIDFACTOR_IMSI,
ALIPAY_TIDFACTOR_TID,
ALIPAY_TIDFACTOR_CLIENTKEY,
ALIPAY_TIDFACTOR_VIMEI,
ALIPAY_TIDFACTOR_VIMSI,
ALIPAY_TIDFACTOR_CLIENTID,
ALIPAY_TIDFACTOR_APDID,
ALIPAY_TIDFACTOR_MAX
} AlipayTidFactor;
typedef void(^CompletionBlock)(NSDictionary *resultDic);
@interface AlipaySDK : NSObject
/**
* 创建支付单例服务
*
* @return 返回单例对象
*/
+ (AlipaySDK *)defaultService;
/**
* 用于设置SDK使用的window,如果没有自行创建window无需设置此接口
*/
@property (nonatomic, weak) UIWindow *targetWindow;
/**
* 支付接口
*
* @param orderStr 订单信息
* @param schemeStr 调用支付的app注册在info.plist中的scheme
* @param compltionBlock 支付结果回调Block,用于wap支付结果回调(非跳转钱包支付)
*/
- (void)payOrder:(NSString *)orderStr
fromScheme:(NSString *)schemeStr
callback:(CompletionBlock)completionBlock;
/**
* 处理钱包或者独立快捷app支付跳回商户app携带的支付结果Url
*
* @param resultUrl 支付结果url
* @param completionBlock 支付结果回调
*/
- (void)processOrderWithPaymentResult:(NSURL *)resultUrl
standbyCallback:(CompletionBlock)completionBlock;
/**
* 获取交易token。
*
* @return 交易token,若无则为空。
*/
- (NSString *)fetchTradeToken;
/**
* 是否已经使用过
*
* @return YES为已经使用过,NO反之
*/
- (BOOL)isLogined;
/**
* 获取当前版本号
*
* @return 当前版本字符串
*/
- (NSString *)currentVersion;
/**
* 获取当前tid相关信息
*
* @return tid相关信息
*/
- (NSString*)queryTidFactor:(AlipayTidFactor)factor;
/**
* 測試所用,realse包无效
*
* @param url 测试环境
*/
- (void)setUrl:(NSString *)url;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////h5 拦截支付入口///////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
/**
* 从h5链接中获取订单串接口
*
* @param urlStr 拦截的 url string
*
* @return 获取到的url order info
*/
- (NSString*)fetchOrderInfoFromH5PayUrl:(NSString*)urlStr;
/**
* h5链接获取到的订单串支付接口
*
* @param orderStr 订单信息
* @param schemeStr 调用支付的app注册在info.plist中的scheme
* @param compltionBlock 支付结果回调Block
*/
- (void)payUrlOrder:(NSString *)orderStr
fromScheme:(NSString *)schemeStr
callback:(CompletionBlock)completionBlock;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////授权1.0//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
/**
* 快登授权
* @param authInfo 需授权信息
* @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
需要调用方在appDelegate中调用processAuthResult:standbyCallback:方法获取授权结果
*/
- (void)authWithInfo:(APayAuthInfo *)authInfo
callback:(CompletionBlock)completionBlock;
/**
* 处理授权信息Url
*
* @param resultUrl 钱包返回的授权结果url
* @param completionBlock 授权结果回调
*/
- (void)processAuthResult:(NSURL *)resultUrl
standbyCallback:(CompletionBlock)completionBlock;
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////授权2.0//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
/**
* 快登授权2.0
*
* @param infoStr 授权请求信息字符串
* @param schemeStr 调用授权的app注册在info.plist中的scheme
* @param completionBlock 授权结果回调,若在授权过程中,调用方应用被系统终止,则此block无效,
需要调用方在appDelegate中调用processAuth_V2Result:standbyCallback:方法获取授权结果
*/
- (void)auth_V2WithInfo:(NSString *)infoStr
fromScheme:(NSString *)schemeStr
callback:(CompletionBlock)completionBlock;
/**
* 处理授权信息Url
*
* @param resultUrl 钱包返回的授权结果url
* @param completionBlock 授权结果回调
*/
- (void)processAuth_V2Result:(NSURL *)resultUrl
standbyCallback:(CompletionBlock)completionBlock;
@end
-------------------------------------------------------
Android版本号:v15.2.1
修改时间:2016-08-17
更新点:
1. 增加支付宝支付和授权2.0体系服务;
2. PayTask新增接口名称:payV2;
3. AuthTask新增接口名称:authV2;
4. 完全兼容1.0体系,1.0体系的支付和授权接口保留。
iOS版本号:v15.2.0
修改时间:2016-08-23
更新点:
1. 增加支付宝支付和授权2.0体系服务;
2. 完全兼容1.0体系,授权和支付接口保持不变;
3. 订单组装问题修复。
-------------------------------------------------------
Android版本号:v15.2.2
修改时间:2016-08-25
更新点:
1. H5支付返回结果Bug修复。
-------------------------------------------------------
Android版本号:v15.2.4
修改时间:2016-10-11
更新点:
1. 新增readme.txt;
2. 修复了2.3系统crash的问题。
-------------------------------------------------------
Android版本号:v15.2.7
修改时间:2016-11-29
更新点:
1. 增加环境设置接口。
-------------------------------------------------------
iOS版本号:v15.2.1
修改时间:2016-12-14
更新点:
1. webview屏蔽alipayjsbridge的调用。
-------------------------------------------------------
Android版本号:v15.2.8
修改时间:2016-12-22
更新点:
1. 体验优化。
-------------------------------------------------------
Android版本号:v15.3.3
修改时间:2016-03-09
更新点:
1. 加入h5支付2.0类url拦截。
-------------------------------------------------------
Android版本号:v15.3.5
修改时间:2016-04-18
更新点:
1. url拦截支付场景 - h5支付返回格式和钱包支付返回格式不一致问题修复。
-------------------------------------------------------
Android版本号:v15.3.6
修改时间:2017-05-10
更新点:
1. 版本升级到15.3.6。
2. 修复了个别商户反馈的走H5支付时获取不到return_url的问题。
3. 修复了沙箱环境fetchOrderInfoFromH5PayUrl方法无效的问题。
-------------------------------------------------------
Android 版本号:v15.3.7
修改时间:2017-06-13
更新点:
1. 修复了 H5 转 Native 支付界面中,无法响应跳转到新窗口的表单的问题。
......@@ -15,6 +15,7 @@
#import "KWMGuideVC.h"
#import "KWMLoginVC.h"
#import "KWMUserModel.h"
#import <AlipaySDK/AlipaySDK.h>
@interface AppDelegate ()
......@@ -106,6 +107,25 @@
// [self.window makeKeyAndVisible];
}
//支付宝 NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
if ([url.host isEqualToString:@"safepay"]) {
//跳转支付宝钱包进行支付,处理支付结果
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
NSLog(@"result = %@",resultDic);
NSNumber *statue = [resultDic objectForKey:@"resultStatus"];
if (statue.integerValue == 9000) {
[[NSNotificationCenter defaultCenter] postNotificationName:KWMPaySuccess object:nil userInfo:nil];
}
}];
}else{//ios9.2之后的系统需要调用(官方文档没有)
return [WXApi handleOpenURL:url delegate:self];
}
return YES;
}
//微信需要重写
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
return [WXApi handleOpenURL:url delegate:self];
}
......@@ -152,6 +172,18 @@
}
break;
}
}else if([resp isKindOfClass:[PayResp class]]){
NSString *strMsg = @"";
switch (resp.errCode) {
case WXSuccess:
NSLog(@"支付成功");
[[NSNotificationCenter defaultCenter] postNotificationName:KWMPaySuccess object:nil userInfo:nil];
break;
default:
strMsg = [NSString stringWithFormat:@"支付结果:失败!retcode = %d, retstr = %@", resp.errCode,resp.errStr];
NSLog(@"支付错误信息%@", strMsg);
break;
}
}
}
......
......@@ -29,6 +29,9 @@
#import "KWMOrder.h"
#import "KWMExchangeRateResult.h"
#import "KWMCartResult.h"
#import "KWMCheckoutPayResult.h"
#import "KWMWechatPayData.h"
......@@ -229,4 +232,36 @@
success:(void(^)(NSURLSessionDataTask *task,KWMProductResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 微信统一下单API
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) wechatPayUnifiedOrder:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 支付宝统一下单API
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) aliPayUnifiedOrder:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 微信订单查询API
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) wechatPayOrderQuery:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
/**
* 支付宝订单查询API
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) aliPayOrderQuery:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure;
@end
......@@ -206,6 +206,7 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
NSAssert((result == [KWMRequestResult class] || result == [KWMRequestListResult class]
|| result == [KWMCheckoutPayResult class]
|| result == [KWMCemaroseResult class] || [result isSubclassOfClass:[KWMCemaroseResult class]]),
@"result class must either be KWMRequestResult or KWMRequestListResult!");
NSAssert((!model || (model && [model isSubclassOfClass:[JSONModel class]])),
......@@ -747,5 +748,87 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
}
/**
* 微信统一下单API
* checkout_token shopify订单token
* total_price 订单总金额
* ip_address 手机IP
* subject 订单描述
* sign 签名验证
* 签名规则
* str_sign = "ip_address=127.0.0.1&checkout_token=5173547165345&subject=test&total_price=23423&key=bd3f58f5cd3d7a217ac8c8e655ab52f8";
* sign = md5(base64_encode($str_sign));
*
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) wechatPayUnifiedOrder:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = @"https://peter.tofnews.com/wechatpay/app/unified_order";
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:[KWMWechatPayData class]
success:success
failure:failure];
}
/**
* 支付宝统一下单API
* checkout_token shopify订单token
* total_price 订单总金额
* subject 订单描述
* sign 签名验证
* 签名规则
* str_sign = checkout_token=5173547165345&subject=test&total_price=23423&key=bd3f58f5cd3d7a217ac8c8e655ab52f8";
* sign = md5(base64_encode($str_sign));
*
* @return NSURLSessionDataTask
*/
- (NSURLSessionDataTask *) aliPayUnifiedOrder:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = @"https://peter.tofnews.com/alipay/app/unified_order";
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:nil
success:success
failure:failure];
}
- (NSURLSessionDataTask *) wechatPayOrderQuery:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = @"https://peter.tofnews.com/wechatpay/order/query";
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:nil
success:success
failure:failure];
}
- (NSURLSessionDataTask *) aliPayOrderQuery:(NSDictionary *)parameters
success:(void(^)(NSURLSessionDataTask *task,KWMCheckoutPayResult *result))success
failure:(void(^)(NSURLSessionDataTask *task,NSError *error))failure{
NSString *apiPath = @"https://peter.tofnews.com/alipay/order/query";
return [self startSessionTask:KWMHTTPMethodPOST
apiPath:apiPath
parameters:parameters
result:[KWMCheckoutPayResult class]
model:nil
success:success
failure:failure];
}
@end
//
// KWMCheckoutPayResult.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <JSONModel/JSONModel.h>
/*
PS:微信支付下单API:
{"status":"success","code":1000,"message":{"appid":"wx355a497b2a2dd6d5","partnerid":"1419214902","prepayid":"wx2017061418173781efbf95390315404901","package":"Sign=WXPay","noncestr":"0f499732a49986c6a281a30db1a2b420","timestamp":1497435463,"sign":"BBB6A0E4937D6F89604B06B730A4F5D9"}}
*/
@interface KWMCheckoutPayResult : JSONModel
//结果状态。success:正常;fail:错误
@property (nonatomic) NSString<Optional> *status;
/*|code|int|1000|正常响应|
|code|int|1001|订单检索失败,未找到相应的订单数据|
|code|int|1002|请求的总金额与订单中不一致|
|code|int|1003|货币转换失败|
|code|int|1004|服务器端未开通店铺|
|code|int|1005|支付网关参数未设置|
|code|int|1006|订单已支付完成|
|code|int|1007|签名验证失败|
|code|int|1008|订单查询失败|
*/
@property (nonatomic) NSNumber<Optional> *code;
//结果详情
@property (nonatomic) id<Optional> message;
//数据--存放解析后的model。ps:只有当微信支付下单返回结果状态为成功时,message key里的数据才会是wechat pay model的数据,此时,会将message里的数据转换为对应的model并存放到data里。
@property (nonatomic) id<Optional> data;
@end
//
// KWMCheckoutPayResult.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCheckoutPayResult.h"
@implementation KWMCheckoutPayResult
- (instancetype)initWithDictionary:(NSDictionary *)dict
modelClass:(Class)modelClass
error:(NSError **)err {
self = [super initWithDictionary:dict error:err];
if (self) {
id messageDict = dict[@"message"];
if(modelClass && messageDict && [messageDict isKindOfClass:[NSDictionary class]]){
self.data = [self buildData:modelClass jsonDictionary:messageDict];
self.message = @"请求成功";
}else{
self.message = messageDict?messageDict:@"";
}
}
return self;
}
- (id)buildData:(Class)modelClass jsonDictionary:(NSDictionary *)jsonDictionary {
id result = nil;
if(modelClass != nil){
NSError *error;
id tmpResult = [[modelClass alloc] initWithDictionary:jsonDictionary error:&error];
if(error){
NSLog(@"buildData error: %@", [error localizedDescription]);
}else{
result = tmpResult;
}
}
return result;
}
@end
//
// KWMWechatPayData.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@interface KWMWechatPayData : KWMBaseModel
/**公众账号ID*/
@property (nonatomic) NSString * _Nullable appid;
/**商户号*/
@property (nonatomic) NSString * _Nullable partnerid;
/**随机字符串*/
@property (nonatomic) NSString * _Nullable noncestr;
/**预支付交易会话标识*/
@property (nonatomic) NSString * _Nullable prepayid;
/**业务结果--不返回*/
@property (nonatomic) NSString * _Nullable resultCode;
/**签名*/
@property (nonatomic) NSString * _Nullable sign;
/**package<Sign=WXPay>**/
@property (nonatomic) NSString * _Nullable package;
/**时间戳*/
@property (nonatomic) NSInteger timestamp;
@end
//
// KWMWechatPayData.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMWechatPayData.h"
@implementation KWMWechatPayData
@end
......@@ -13,8 +13,10 @@
#import "KWMSelectAddressVC.h"
#import "KWMAddGiftCardVC.h"
#import "KWMShippingVC.h"
#import "KWMPayTypeVC.h"
@interface KWMBeforePayVC : KWMBaseVC<KWMGiftCardDelegate,KWMDiscountDelegate,KWMSelectAddressDelegate,KWMSelectShippingRateDelegate>
@interface KWMBeforePayVC : KWMBaseVC<KWMGiftCardDelegate,KWMDiscountDelegate,KWMSelectAddressDelegate,KWMSelectShippingRateDelegate,KWMPayTypeDelegate>
//沒有默認地址時,高度為37,有地址時,高度為90
@property(nonatomic,weak) IBOutlet NSLayoutConstraint *vAddressHeight;
......@@ -56,6 +58,8 @@
//快速购买购物车
@property (nonatomic) BUYCart *fastPayCart;
@property (nonatomic) KWMPayType payType;
@property (strong, nonatomic) NSString *cartCookie;
- (IBAction)onClickPayType:(id)sender;
......
......@@ -9,7 +9,6 @@
#import "KWMBeforePayVC.h"
#import "KWMDiscountVC.h"
#import "KWMSelectAddressVC.h"
#import "KWMPayTypeVC.h"
#import "KWMPaySuccessVC.h"
#import "KWMShopCartModel.h"
#import "KWMStringUtil.h"
......@@ -20,7 +19,7 @@
#import <RegexKitLite/RegexKitLite.h>
#import "KWMHttpUtil.h"
#import "KWMValidateUtil.h"
#import "KWMPayUtil.h"
@interface KWMBeforePayVC ()
@property (nonatomic) BUYCustomer *customer;
......@@ -47,6 +46,22 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"提交订单";
//支付成功回调广播接收者 ##通过广播接受appdelegate中的支付回调。
NSNotificationCenter *notifi = [NSNotificationCenter defaultCenter];
[notifi addObserver:self selector:@selector(paySuccess) name:KWMPaySuccess object:nil];
}
-(void)dealloc{
//注销支付成功广播接收者
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self
name:KWMPaySuccess
object:nil];
}
-(void)setPayType:(KWMPayType)payType{
_payType = payType;
self.lbPayType.text = [KWMPayUtil payTypeString:payType];
}
-(void)initDefaultData{
......@@ -132,6 +147,10 @@
[self initData];
}
-(void)kwm_onSelectPayType:(KWMPayType)payType{
self.payType = payType;
}
- (void)initData{
if(self.checkout == nil){
[self showToast:@"未成功创建订单"];
......@@ -336,6 +355,7 @@
return;
}
KWMPayTypeVC *typeVC = (KWMPayTypeVC *)[KWMBaseVC findControllerBy:[KWMPayTypeVC kwmTag] fromStoryboard:@"ShopCart"];
typeVC.delegate = self;
[self.navigationController pushViewController:typeVC animated:YES];
}
......@@ -392,6 +412,10 @@
[self showToast:@"请先选择地址"];
return;
}
if(self.payType == TypeNone){
[self showToast:@"请选择一种付款方式"];
return;
}
if(self.checkout.shippingRate == nil){
[self showToast:@"请先选择配送方式"];
return;
......@@ -400,9 +424,20 @@
[self showToast:@"未成功创建支付链接"];
return;
}
KWMCheckoutWebViewVC *checkoutVC = (KWMCheckoutWebViewVC *)[KWMBaseVC findControllerBy:[KWMCheckoutWebViewVC kwmTag] fromStoryboard:@"ShopCart"];
checkoutVC.payURL = self.checkout.webCheckoutURL;
[self.navigationController pushViewController:checkoutVC animated:YES];
//不同的支付方式
switch (self.payType) {
case TypeCredit:
[self goToWebPay];
break;
case TypeAlipay:
[self requestAliPay];
break;
case TypeWechatPay:
[self requestWeChatPay];
break;
default:
break;
}
}
//设置配送费到订单
......@@ -560,6 +595,72 @@
}];
}
//支付宝支付
-(void)requestAliPay{
NSDictionary *parameters = [KWMPayUtil aliPayParameters:self.checkout];
__weak KWMBeforePayVC *weakSelf = self;
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
[weakSelf hideLoading];
[weakSelf showError:error];
};
void(^success)(NSURLSessionDataTask *,KWMCheckoutPayResult *) = ^(NSURLSessionDataTask *task,KWMCheckoutPayResult *result){
[weakSelf hideLoading];
if(!result){
return;
}
if(!result.code || result.code.integerValue != 1000){
return;
}
NSString *alipayData = (NSString *)result.message;
[KWMPayUtil aliPay:alipayData callback:^(NSDictionary *resultDic) {
NSLog(@"reslut = %@",resultDic);
NSNumber *statue = [resultDic objectForKey:@"resultStatus"];
if (statue.integerValue == 9000) {
[weakSelf paySuccess];
}
}];
};
[self.api aliPayUnifiedOrder:parameters success:success failure:failure];
[self showLoading];
}
//微信支付
-(void)requestWeChatPay{
NSDictionary *parameters = [KWMPayUtil wechatPayParameters:self.checkout];
__weak KWMBeforePayVC *weakSelf = self;
void(^failure)(NSURLSessionDataTask *,NSError *) = ^(NSURLSessionDataTask *task,NSError *error){
[weakSelf hideLoading];
[weakSelf showError:error];
};
void(^success)(NSURLSessionDataTask *,KWMCheckoutPayResult *) = ^(NSURLSessionDataTask *task,KWMCheckoutPayResult *result){
[weakSelf hideLoading];
if(!result){
return;
}
if(!result.code || result.code.integerValue != 1000){
return;
}
if(result.data){
KWMWechatPayData *data = (KWMWechatPayData *)result.data;
[KWMPayUtil weChatPay:data];
}
};
[self.api wechatPayUnifiedOrder:parameters success:success failure:failure];
[self showLoading];
}
-(void)goToWebPay{
KWMCheckoutWebViewVC *checkoutVC = (KWMCheckoutWebViewVC *)[KWMBaseVC findControllerBy:[KWMCheckoutWebViewVC kwmTag] fromStoryboard:@"ShopCart"];
checkoutVC.payURL = self.checkout.webCheckoutURL;
[self.navigationController pushViewController:checkoutVC animated:YES];
}
-(void)paySuccess{
KWMPaySuccessVC *successVC = (KWMPaySuccessVC *)[KWMBaseVC findControllerBy:[KWMPaySuccessVC kwmTag] fromStoryboard:@"ShopCart"];
[self.navigationController pushViewController:successVC animated:YES];
}
////判断订单是否支付
//-(void)requestCheckPay:(BUYCheckout *)checkCache{
// [self showLoading];
......
......@@ -8,6 +8,18 @@
#import "KWMBaseVC.h"
typedef NS_ENUM(NSInteger, KWMPayType) {
TypeNone = 0,
TypeCredit,
TypeAlipay,
TypeWechatPay
};
@protocol KWMPayTypeDelegate <NSObject>
- (void)kwm_onSelectPayType:(KWMPayType)payType;
@end
@interface KWMPayTypeVC : KWMBaseVC
- (IBAction)onClickWechatPay:(id)sender;
......@@ -16,5 +28,7 @@
- (IBAction)onClickCreditPay:(id)sender;
@property (weak, nonatomic) id<KWMPayTypeDelegate>delegate;
@end
......@@ -30,18 +30,26 @@
-(void)onClickAliPay:(id)sender{
if(self.delegate){
[self.delegate kwm_onSelectPayType:TypeAlipay];
}
[[self navigationController] popViewControllerAnimated:YES];
}
-(void)onClickCreditPay:(id)sender{
if(self.delegate){
[self.delegate kwm_onSelectPayType:TypeCredit];
}
[[self navigationController] popViewControllerAnimated:YES];
}
-(void)onClickWechatPay:(id)sender{
if(self.delegate){
[self.delegate kwm_onSelectPayType:TypeWechatPay];
}
[[self navigationController] popViewControllerAnimated:YES];
}
@end
......@@ -155,7 +155,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="e7Y-ej-nID" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="84" y="164"/>
<point key="canvasLocation" x="249" y="170"/>
</scene>
<!--收货地址-->
<scene sceneID="ioM-eK-Y5z">
......@@ -597,7 +597,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="549"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BlA-Cz-DcE">
<rect key="frame" x="0.0" y="0.0" width="374" height="427"/>
<rect key="frame" x="0.0" y="0.0" width="374" height="522"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄送地址" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MY5-C7-Kcb">
<rect key="frame" x="30" y="22" width="60" height="21"/>
......@@ -682,26 +682,23 @@
<constraint firstAttribute="height" constant="90" id="zO1-RN-x44"/>
</constraints>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="支付" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Afz-nz-wCb">
<rect key="frame" x="30" y="145" width="30" height="0.0"/>
<constraints>
<constraint firstAttribute="height" id="yxT-jw-7PG"/>
</constraints>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="支付" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Afz-nz-wCb">
<rect key="frame" x="30" y="167" width="30" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.21960784310000001" green="0.21960784310000001" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1ep-3i-rAZ" userLabel="v支付方式">
<rect key="frame" x="0.0" y="145" width="374" height="0.0"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1ep-3i-rAZ" userLabel="v支付方式">
<rect key="frame" x="0.0" y="200" width="374" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请选择一种付款方式" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fr9-gU-u2X">
<rect key="frame" x="30" y="-8" width="314" height="17"/>
<rect key="frame" x="30" y="12" width="314" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.22352941179999999" green="0.22352941179999999" blue="0.22352941179999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3Ed-rJ-foG">
<rect key="frame" x="324" y="-10" width="20" height="20"/>
<rect key="frame" x="324" y="10" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="F3M-l6-kCX"/>
<constraint firstAttribute="width" constant="20" id="ULG-n2-05F"/>
......@@ -719,17 +716,17 @@
<constraint firstItem="3Ed-rJ-foG" firstAttribute="centerY" secondItem="1ep-3i-rAZ" secondAttribute="centerY" id="Ugt-Rl-La6"/>
<constraint firstItem="Fr9-gU-u2X" firstAttribute="leading" secondItem="1ep-3i-rAZ" secondAttribute="leading" constant="30" id="fcL-xz-nJH"/>
<constraint firstItem="Fr9-gU-u2X" firstAttribute="centerY" secondItem="1ep-3i-rAZ" secondAttribute="centerY" id="zUq-aP-qzD"/>
<constraint firstAttribute="height" id="zbx-Pl-0TZ"/>
<constraint firstAttribute="height" constant="40" id="zbx-Pl-0TZ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="配送方式" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hsl-7w-xKW" userLabel="配送">
<rect key="frame" x="30" y="167" width="60" height="21"/>
<rect key="frame" x="30" y="262" width="60" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.21960784310000001" green="0.21960784310000001" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BOf-h7-67C" userLabel="v配送">
<rect key="frame" x="0.0" y="200" width="374" height="39"/>
<rect key="frame" x="0.0" y="295" width="374" height="39"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请选择配送方式" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pVN-aG-lfu">
<rect key="frame" x="30" y="11" width="314" height="17"/>
......@@ -760,13 +757,13 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="礼品卡" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="meM-14-BFw" userLabel="礼品卡">
<rect key="frame" x="30" y="261" width="45" height="21"/>
<rect key="frame" x="30" y="356" width="45" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.21960784310000001" green="0.21960784310000001" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3g3-iU-dSA" userLabel="v礼品卡">
<rect key="frame" x="0.0" y="294" width="374" height="39"/>
<rect key="frame" x="0.0" y="389" width="374" height="39"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请输入礼品卡" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2lC-1w-Lfh">
<rect key="frame" x="30" y="11" width="314" height="17"/>
......@@ -797,13 +794,13 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="优惠码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LpT-uQ-5JS" userLabel="优惠码">
<rect key="frame" x="30" y="355" width="45" height="21"/>
<rect key="frame" x="30" y="450" width="45" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.21960784310000001" green="0.21960784310000001" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wga-vh-5gr" userLabel="v优惠码">
<rect key="frame" x="0.0" y="388" width="374" height="39"/>
<rect key="frame" x="0.0" y="483" width="374" height="39"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请输入优惠码" textAlignment="natural" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7E5-kf-ON8">
<rect key="frame" x="30" y="11" width="314" height="17"/>
......@@ -842,14 +839,14 @@
<constraint firstAttribute="bottom" secondItem="Wga-vh-5gr" secondAttribute="bottom" id="9mb-Gf-9QV"/>
<constraint firstItem="LpT-uQ-5JS" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" constant="30" id="AJZ-cD-G5p"/>
<constraint firstItem="Hsl-7w-xKW" firstAttribute="top" secondItem="1ep-3i-rAZ" secondAttribute="bottom" constant="22" id="CJA-Sb-ajp"/>
<constraint firstItem="Afz-nz-wCb" firstAttribute="top" secondItem="qFl-Qx-3nj" secondAttribute="bottom" id="Cop-l6-ap2"/>
<constraint firstItem="Afz-nz-wCb" firstAttribute="top" secondItem="qFl-Qx-3nj" secondAttribute="bottom" constant="22" id="Cop-l6-ap2"/>
<constraint firstItem="Wga-vh-5gr" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" id="Db6-Ap-r5f"/>
<constraint firstItem="BOf-h7-67C" firstAttribute="top" secondItem="Hsl-7w-xKW" secondAttribute="bottom" constant="12" id="Hsf-NW-m1u"/>
<constraint firstItem="BOf-h7-67C" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" id="JAc-2L-MKm"/>
<constraint firstItem="LpT-uQ-5JS" firstAttribute="top" secondItem="3g3-iU-dSA" secondAttribute="bottom" constant="22" id="LDa-RL-PlM"/>
<constraint firstAttribute="trailing" secondItem="1ep-3i-rAZ" secondAttribute="trailing" id="QPV-y4-sps"/>
<constraint firstItem="meM-14-BFw" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" constant="30" id="Rzq-h1-6xo"/>
<constraint firstItem="1ep-3i-rAZ" firstAttribute="top" secondItem="Afz-nz-wCb" secondAttribute="bottom" id="Yzf-a1-PQ6"/>
<constraint firstItem="1ep-3i-rAZ" firstAttribute="top" secondItem="Afz-nz-wCb" secondAttribute="bottom" constant="12" id="Yzf-a1-PQ6"/>
<constraint firstItem="1ep-3i-rAZ" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" id="bOr-Re-U8w"/>
<constraint firstAttribute="trailing" secondItem="Wga-vh-5gr" secondAttribute="trailing" id="bib-a1-w42"/>
<constraint firstItem="qFl-Qx-3nj" firstAttribute="leading" secondItem="BlA-Cz-DcE" secondAttribute="leading" id="dLM-dh-XZx"/>
......
//
// KWMPayUtil.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
// 支付相关工具类
#import "KWMWechatPayData.h"
#import "KWMPayTypeVC.h"
#import <Foundation/Foundation.h>
#import <Buy/Buy.h>
#import <AlipaySDK/AlipaySDK.h>
#import "WXApi.h"
@interface KWMPayUtil : NSObject
+ (NSString *) payTypeString:(KWMPayType)payType;
//构建微信支付下单数据
+ (NSDictionary *) wechatPayParameters:(BUYCheckout *)checkout;
//构建支付宝下单数据
+ (NSDictionary *) aliPayParameters:(BUYCheckout *)checkout;
//调用微信SDK
+ (void)weChatPay:(KWMWechatPayData *)wechatData;
//调用支付宝SDK
+ (void)aliPay:(NSString *)alipayData callback:(CompletionBlock)callback;
@end
//
// KWMPayUtil.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMPayUtil.h"
#import "KWMStringUtil.h"
@implementation KWMPayUtil
+(NSString *)payTypeString:(KWMPayType)payType{
NSString *payTypeString = @"";
switch (payType) {
case TypeNone:
payTypeString = @"请选择一种付款方式";
break;
case TypeCredit:
payTypeString = @"信用卡支付";
break;
case TypeWechatPay:
payTypeString = @"微信支付";
break;
case TypeAlipay:
payTypeString = @"支付宝支付";
break;
}
return payTypeString;
}
+(NSDictionary *)wechatPayParameters:(BUYCheckout *)checkout{
//这是测试商店的单,先用来测试
NSString *checkout_token = @"bfa0423b2b51657098d581a93e78bc00";
NSString *total_price = @"127.00";
//NSString *checkout_token = checkout.token;
//NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
NSString *ip_address = @"127.0.0.1";
//先写test,后面改成正式的订单描述
NSString *subject = @"test";
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&ip_address=%@&subject=%@&total_price=%@&key=%@",
checkout_token,ip_address,subject,total_price,User_Pay_KEY];
NSString *base64String = [KWMStringUtil BASE64:before_sign];
NSString *sign = [KWMStringUtil MD5:base64String];
NSDictionary *parameters = @{
@"ip_address":ip_address,
@"checkout_token":checkout_token,
@"subject":subject,
@"total_price":total_price,
@"sign":sign
};
return parameters;
}
+(NSDictionary *)aliPayParameters:(BUYCheckout *)checkout{
//这是测试商店的单,先用来测试
NSString *checkout_token = @"bfa0423b2b51657098d581a93e78bc00";
NSString *total_price = @"127.00";
//NSString *checkout_token = checkout.token;
//NSString *total_price = [NSString stringWithFormat:@"%.2f",checkout.totalPrice.floatValue];
NSString *subject = @"test";
NSString *before_sign = [NSString stringWithFormat:@"checkout_token=%@&subject=%@&total_price=%@&key=%@",
checkout_token,subject,total_price,User_Pay_KEY];
NSString *base64String = [KWMStringUtil BASE64:before_sign];
NSString *sign = [KWMStringUtil MD5:base64String];
NSDictionary *parameters = @{
@"checkout_token":checkout_token,
@"subject":subject,
@"total_price":total_price,
@"sign":sign
};
return parameters;
}
+(void)weChatPay:(KWMWechatPayData *)wechatData{
if(wechatData){
PayReq *request = [[PayReq alloc] init];
request.openID = wechatData.appid;
request.partnerId = wechatData.partnerid;
request.prepayId= wechatData.prepayid;
request.package = wechatData.package;
request.nonceStr= wechatData.noncestr;
request.timeStamp= wechatData.timestamp;
request.sign= wechatData.sign;
[WXApi sendReq:request];
}
}
+(void)aliPay:(NSString *)alipayData callback:(CompletionBlock)callback{
if(![KWMStringUtil isEmpty:alipayData]){
NSString *appScheme = @"iCemarose";
[[AlipaySDK defaultService] payOrder:alipayData fromScheme:appScheme callback:callback];
}
}
@end
......@@ -9,6 +9,7 @@
@interface KWMStringUtil : NSObject
+ (NSString *)MD5:(NSString *)input;
+ (NSString *)BASE64:(NSString *)input;
/**是否是空字符串*/
+ (BOOL)isEmpty:(NSString *)input;
/**是否是空白(有空格都是)的字符串*/
......
......@@ -30,6 +30,14 @@ static NSDateFormatter *monthDayFormatter;
return [input sam_MD5Digest];
}
+ (NSString *)BASE64:(NSString *)input {
if(!input){
return input;
}
return [input sam_base64EncodedString];
}
+ (BOOL)isEmpty:(NSString *)input {
return [input isKindOfClass:[NSNull class]] || input == nil || [input length] <= 0;
}
......
......@@ -36,32 +36,29 @@
#define KWMNoCollect 7
#define KWMReceiverRedPoint @"KWMReceiverRedPoint"
#define KEY_USER_RED_POINT_COMMENT_MESSAGE @"KEY_USER_RED_POINT_COMMENT_MESSAGE"
#define KEY_USER_RED_POINT_FANS_MESSAGE @"KEY_USER_RED_POINT_FANS_MESSAGE"
#define KEY_USER_RED_POINT_LIKE_REWARD_MESSAGE @"KEY_USER_RED_POINT_LIKE_REWARD_MESSAGE"
#define KEY_USER_RED_POINT_COLLECT_MESSAGE @"KEY_USER_RED_POINT_COLLECT_MESSAGE"
#define KWMReceiverPush @"KWMReceiverPush"
#define KWMReceiverNoLogin @"KWMReceiverNoLogin"
#define KWMPaySuccess @"KWMPaySuccess"
#define KEY_USER_DEFAULT_ACCOUNT @"KEY_USER_DEFAULT_ACCOUNT"
#define KEY_USER_REGISTER @"KEY_USER_REGISTER"
#define UMAppKey @"57551aaee0f55aea54000a83"
#define UMAppKey @"##"
#define UmengChannel @"C001"
#define JPUSHKey @"35f3186c1b31d56a8f88033c"
#define JPUSHKey @"##"
//正式的 QQ app id
#define QQAppId @"1105432469"
#define QQAppKey @"9Fh1cjV39jKenBUM"
#define QQAppId @"##"
#define QQAppKey @"##"
//正式的微信key
#define WechatAppKey @"wx355a497b2a2dd6d5"
#define WechatSecret @"7bb8615cdb4d750b66b653385e641f15"
//Cemarose key--chinese login 需要的key
#define Cemarose_KEY @"4a119ac523d53c98bbd2983b798a0d53"
#define User_Pay_KEY @"bd3f58f5cd3d7a217ac8c8e655ab52f8"
////
////测试
......
......@@ -35,6 +35,14 @@
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>iCemarose</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cemarose</string>
</array>
</dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment