Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支付有礼SDK #182

Merged
merged 4 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
| goldplan | 点金计划 ||✔️|
| wexinpayscoreparking | 微信支付分停车 |✔️|✔️|
| merchantexclusivecoupon | 商家券 |✔️|✔️|
| giftactivity | 支付有礼 |✔️|✔️|
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.wechat.pay.java.service.giftactivity;

import com.wechat.pay.java.core.RSAConfig;
import com.wechat.pay.java.service.giftactivity.model.AddActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.AddActivityMerchantResponse;
import com.wechat.pay.java.service.giftactivity.model.CreateFullSendActRequest;
import com.wechat.pay.java.service.giftactivity.model.CreateFullSendActResponse;
import com.wechat.pay.java.service.giftactivity.model.DeleteActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.DeleteActivityMerchantResponse;
import com.wechat.pay.java.service.giftactivity.model.GetActDetailRequest;
import com.wechat.pay.java.service.giftactivity.model.GetActDetailResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActMchResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActSkuResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActivitiesRequest;
import com.wechat.pay.java.service.giftactivity.model.ListActivitiesResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.ListActivitySkuRequest;
import com.wechat.pay.java.service.giftactivity.model.TerminateActResponse;
import com.wechat.pay.java.service.giftactivity.model.TerminateActivityRequest;

/** GiftActivityService使用示例 */
public class GiftActivityServiceExample {

public static String merchantId = "";
public static String privateKeyPath = "";
public static String merchantSerialNumber = "";
public static String wechatPayCertificatePath = "";
public static GiftActivityService service;

public static void main(String[] args) {
// 初始化商户配置
RSAConfig config =
new RSAConfig.Builder()
.merchantId(merchantId)
// 使用 com.wechat.pay.java.core.util 中的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(merchantSerialNumber)
.wechatPayCertificatesFromPath(wechatPayCertificatePath)
.build();

// 初始化服务
service = new GiftActivityService.Builder().config(config).build();
// ... 调用接口
}
/** 新增活动发券商户号 */
public static AddActivityMerchantResponse addActivityMerchant() {

AddActivityMerchantRequest request = new AddActivityMerchantRequest();
return service.addActivityMerchant(request);
}
/** 创建全场满额送活动 */
public static CreateFullSendActResponse createFullSendAct() {
CreateFullSendActRequest request = new CreateFullSendActRequest();
return service.createFullSendAct(request);
}
/** 删除活动发券商户号 */
public static DeleteActivityMerchantResponse deleteActivityMerchant() {

DeleteActivityMerchantRequest request = new DeleteActivityMerchantRequest();
return service.deleteActivityMerchant(request);
}
/** 获取活动详情接口 */
public static GetActDetailResponse getActDetail() {

GetActDetailRequest request = new GetActDetailRequest();
return service.getActDetail(request);
}
/** 获取支付有礼活动列表 */
public static ListActivitiesResponse listActivities() {

ListActivitiesRequest request = new ListActivitiesRequest();
return service.listActivities(request);
}
/** 获取活动发券商户号 */
public static ListActMchResponse listActivityMerchant() {

ListActivityMerchantRequest request = new ListActivityMerchantRequest();
return service.listActivityMerchant(request);
}
/** 获取活动指定商品列表 */
public static ListActSkuResponse listActivitySku() {

ListActivitySkuRequest request = new ListActivitySkuRequest();
return service.listActivitySku(request);
}
/** 终止活动 */
public static TerminateActResponse terminateActivity() {

TerminateActivityRequest request = new TerminateActivityRequest();
return service.terminateActivity(request);
}
}
Loading