Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
64bfda26
Commit
64bfda26
authored
Aug 01, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,查询订单支付api,添加参数out_trade_no
2,分类页默认选中修改
parent
93b80362
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
21 deletions
+24
-21
KWMAPIManager.m
iCemarose/Class/Api/KWMAPIManager.m
+2
-1
KWMBeforePayData.h
iCemarose/Class/Model/KWMBeforePayData.h
+2
-0
KWMWechatPayData.h
iCemarose/Class/Model/KWMWechatPayData.h
+2
-1
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+1
-1
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+4
-0
KWMBeforePayVC.m
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
+6
-10
KWMPayUtil.h
iCemarose/Class/Util/KWMPayUtil.h
+1
-1
KWMPayUtil.m
iCemarose/Class/Util/KWMPayUtil.m
+6
-7
No files found.
iCemarose/Class/Api/KWMAPIManager.m
View file @
64bfda26
...
...
@@ -874,9 +874,10 @@ static NSString *const passwordTest = @"9e84aae218c57cdf0762763c4cf5a651";
/**
* 通过checkout_token查询shopify订单API
* @param checkout_token shopify订单token
* @param out_trade_no 订单支付编号
* @param sign 签名验证
* 签名规则:
* str_sign = checkout_token=5173547165345&key=bd3f58f5cd3d7a217ac8c8e655ab52f8";
* str_sign = checkout_token=5173547165345&
out_trade_no=201708011602269375&
key=bd3f58f5cd3d7a217ac8c8e655ab52f8";
* sign = md5(base64_encode($str_sign));
*/
-
(
NSURLSessionDataTask
*
)
appOrderQuery
:
(
NSDictionary
*
)
parameters
...
...
iCemarose/Class/Model/KWMBeforePayData.h
View file @
64bfda26
...
...
@@ -14,4 +14,6 @@
@property
(
nonatomic
)
KWMWechatPayData
*
wechatPayData
;
@property
(
nonatomic
)
NSString
*
outTradeNo
;
@end
iCemarose/Class/Model/KWMWechatPayData.h
View file @
64bfda26
...
...
@@ -26,6 +26,7 @@
@property
(
nonatomic
)
NSString
*
_Nullable
package
;
/**时间戳*/
@property
(
nonatomic
)
NSInteger
timestamp
;
/**微信订单编号*/
@property
(
nonatomic
)
NSString
*
_Nullable
outTradeNo
;
@end
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
64bfda26
...
...
@@ -124,7 +124,7 @@
return
m
;
}];
self
.
selectedCategory
=
self
.
categories
.
firstObject
;
NSIndexPath
*
path
=
[
NSIndexPath
indexPathForItem
:
1
inSection
:
0
];
NSIndexPath
*
path
=
[
NSIndexPath
indexPathForItem
:
0
inSection
:
0
];
[
self
.
tbvLeftCategory
selectRowAtIndexPath
:
path
animated
:
YES
scrollPosition
:
UITableViewScrollPositionTop
];
}
...
...
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
64bfda26
...
...
@@ -167,7 +167,11 @@ typedef enum{
#pragma mark - KWMMenuDelegate
-
(
void
)
kwm_onClickHotMenu
{
if
([
TestModel
isEqualToString
:
@"YES"
]){
[
self
openURLWithString
:[
NSString
stringWithFormat
:
@"https://cemarose.myshopify.com/products/%@"
,
@"17618-01"
]];
}
else
{
[
self
openURLWithString
:
@"https://cemarose.myshopify.com/collections/new?title=最新单品"
];
}
}
-
(
void
)
kwm_onClickNewMenu
{
...
...
iCemarose/Class/UI/ShopCart/KWMBeforePayVC.m
View file @
64bfda26
...
...
@@ -570,8 +570,6 @@
if
(
this
.
checkout
.
shippingAddress
&&
!
this
.
checkout
.
shippingRate
)
{
[
this
requestShippingData
];
}
//排除已被支付的checkout的可能性
[
this
requestOrderPayResult
];
}
failure
:^
(
NSURLSessionDataTask
*
_Nullable
task
,
NSError
*
_Nonnull
error
)
{
[
this
hideLoading
];
[
this
showError
:
error
];
...
...
@@ -622,13 +620,11 @@
}
-
(
void
)
requestOrderPayResult
{
//微信支付,用户支付后,当用户没有点击完成按钮,而是直接使用home键,或者点击状态栏左上角返回APP订单页面时,微信的回调不会调用,而很容易出现
订单结果
丢失的情况,所以需要再确认一次订单是否完成。
//微信支付,用户支付后,当用户没有点击完成按钮,而是直接使用home键,或者点击状态栏左上角返回APP订单页面时,微信的回调不会调用,而很容易出现
本地订单结果回调
丢失的情况,所以需要再确认一次订单是否完成。
//支付宝暂时没有这种问题。
//另外用到的情况:上次被支付的订单,因某些突发原因没从缓存清除。
//if(self.beforePayData && self.beforePayData.wechatPayData && self.checkout){
if
(
self
.
checkout
){
NSDictionary
*
parameters
=
[
KWMPayUtil
payResultParameters
:
self
.
checkout
];
self
.
beforePayData
.
wechatPayData
=
nil
;
if
(
self
.
beforePayData
&&
!
[
KWMStringUtil
isEmpty
:
self
.
beforePayData
.
outTradeNo
]
&&
self
.
checkout
){
NSDictionary
*
parameters
=
[
KWMPayUtil
payResultParameters
:
self
.
checkout
tradeNo
:
self
.
beforePayData
.
outTradeNo
];
self
.
beforePayData
.
outTradeNo
=
@""
;
__weak
KWMBeforePayVC
*
weakSelf
=
self
;
void
(
^
failure
)(
NSURLSessionDataTask
*
,
NSError
*
)
=
^
(
NSURLSessionDataTask
*
task
,
NSError
*
error
){
//[weakSelf showError:error];
...
...
@@ -641,7 +637,7 @@
return
;
}
if
(
result
.
data
){
KWMOrderPaid
*
data
=
(
KWMOrderPaid
*
)
result
.
data
;
//
KWMOrderPaid *data = (KWMOrderPaid *)result.data;
[
weakSelf
paySuccess
];
}
};
...
...
@@ -706,7 +702,7 @@
if
(
result
.
data
){
KWMWechatPayData
*
data
=
(
KWMWechatPayData
*
)
result
.
data
;
[
KWMPayUtil
weChatPay
:
data
];
weakSelf
.
beforePayData
.
wechatPayData
=
data
;
weakSelf
.
beforePayData
.
outTradeNo
=
data
.
outTradeNo
;
}
};
[
self
.
api
wechatPayUnifiedOrder
:
parameters
success
:
success
failure
:
failure
];
...
...
iCemarose/Class/Util/KWMPayUtil.h
View file @
64bfda26
...
...
@@ -26,7 +26,7 @@
+
(
NSDictionary
*
)
aliPayParameters
:(
BUYCheckout
*
)
checkout
;
//构建支付结果查询数据
+
(
NSDictionary
*
)
payResultParameters
:(
BUYCheckout
*
)
checkout
;
+
(
NSDictionary
*
)
payResultParameters
:(
BUYCheckout
*
)
checkout
tradeNo
:(
NSString
*
)
tradeNo
;
//调用微信SDK
+
(
void
)
weChatPay
:(
KWMWechatPayData
*
)
wechatData
;
...
...
iCemarose/Class/Util/KWMPayUtil.m
View file @
64bfda26
...
...
@@ -81,22 +81,21 @@
return
parameters
;
}
//现在在两个地方会用到这条api
//1,支付后切换回到APP
//2,beforepay创建/复用旧checkout时,判断该checkout是否被支付了,但是之前没清空。
+
(
NSDictionary
*
)
payResultParameters
:(
BUYCheckout
*
)
checkout
{
//微信支付后直接切换回到APP会调用此方法
+
(
NSDictionary
*
)
payResultParameters
:(
BUYCheckout
*
)
checkout
tradeNo
:(
NSString
*
)
tradeNo
{
#if DEBUG
NSString
*
checkout_token
=
checkout
.
token
;
#else
NSString
*
checkout_token
=
checkout
.
token
;
#endif
NSString
*
before_sign
=
[
NSString
stringWithFormat
:
@"checkout_token=%@&key=%@"
,
checkout_token
,
User_Pay_KEY
];
NSString
*
out_trade_no
=
tradeNo
?:
@""
;
NSString
*
before_sign
=
[
NSString
stringWithFormat
:
@"checkout_token=%@&out_trade_no=%@&key=%@"
,
checkout_token
,
out_trade_no
,
User_Pay_KEY
];
NSString
*
base64String
=
[
KWMStringUtil
BASE64
:
before_sign
];
NSString
*
sign
=
[
KWMStringUtil
MD5
:
base64String
];
NSDictionary
*
parameters
=
@{
@"checkout_token"
:
checkout_token
,
@"out_trade_no"
:
out_trade_no
,
@"sign"
:
sign
};
return
parameters
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment