Skip to content

Commit

Permalink
Merge branch 'next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode authored Jul 4, 2023
2 parents 265ba4e + 6b48d5d commit 455651e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/taro-h5/src/api/alipay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import { temporarilyNotSupport } from '../../utils'

// AliPay
export const getOpenUserInfo = /* @__PURE__ */ temporarilyNotSupport('getOpenUserInfo')
export const tradePay = /* @__PURE__ */ temporarilyNotSupport('tradePay')
2 changes: 1 addition & 1 deletion packages/taro-h5/src/api/media/video/chooseMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const chooseMedia = async function (
const { tapIndex } = await showActionSheet({
itemList: ['拍摄', '从相册选择'],
}, methodName)
sourceType.splice(0, 1, tapIndex === 0 ? 'camera' : 'album')
sourceType.splice(0, sourceType.length, tapIndex === 0 ? 'camera' : 'album')
} catch (e) {
return handle.fail({
errMsg: e.errMsg?.replace('^.*:fail ', '')
Expand Down
43 changes: 43 additions & 0 deletions packages/taro/types/api/alipay/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,55 @@ declare module '../../index' {
response: string
}
}
namespace tradePay {
interface Option {
/** 接入小程序支付时传入此参数。此参数为支付宝交易号,注意参数有大小写区分(调用 小程序支付 时必填) */
tradeNO?: string
/** 完整的支付参数拼接成的字符串,从服务端获取(调用 支付宝预授权 时必填) */
orderStr?: string
/** 接口调用成功的回调函数 */
success?: (res: SuccessCallbackResult) => void
/** 接口调用失败的回调函数 */
fail?: (res: TaroGeneral.CallbackResult) => void
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?:(res: TaroGeneral.CallbackResult) => void
}
interface ResultCode {
/** 无权限调用(N22104) */
4
/** 订单处理成功 */
9000
/** 正在处理中。支付结果未知(有可能已经支付成功) */
8000
/** 订单处理失败 */
4000
/** 用户中途取消 */
6001
/** 网络连接出错 */
6002
/** 处理结果未知(有可能已经成功) */
6004
}
interface SuccessCallbackResult {
/** success 回调函数会携带一个 Object 类型的对象,其属性如下: */
response: {
resultCode: ResultCode
}
}
}
interface TaroStatic {
/**
* 此接口可获取支付宝会员的基础信息(头像图片地址、昵称、性别、国家码、省份、所在市区),接入方法请参考 获取会员基础信息介绍。如需获取支付宝会员标识(user_id),请调用 my.getAuthCode 和 alipay.system.oauth.token 接口。
* @supported alipay
* @see https://docs.alipay.com/mini/api/ch8chh
*/
getOpenUserInfo(Option: getOpenUserInfo.Option): Promise<getOpenUserInfo.SuccessCallbackResult>

/**
* 此接口是用于发起支付的 API,此 API 暂仅支持企业支付宝小程序使用
* @supported alipay
* @see https://opendocs.alipay.com/mini/api/openapi-pay
*/
tradePay(Option: tradePay.Option): Promise<tradePay.SuccessCallbackResult>
}
}

0 comments on commit 455651e

Please sign in to comment.