Skip to content

Commit

Permalink
Merge pull request #19 from iamport/feature/paymentwall-add-parameter
Browse files Browse the repository at this point in the history
페이먼트월 관련 parameter 추가
  • Loading branch information
kian2727 authored Mar 30, 2022
2 parents 0b8c68d + c2ee29b commit 9b466bc
Show file tree
Hide file tree
Showing 9 changed files with 1,282 additions and 884 deletions.
42 changes: 27 additions & 15 deletions src/main/java/com/siot/IamportRestClient/Iamport.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.siot.IamportRestClient.response.naver.NaverProductOrder;
import com.siot.IamportRestClient.response.naver.NaverReview;

import org.junit.runners.Parameterized;
import retrofit2.Call;
import retrofit2.http.*;

Expand All @@ -18,25 +19,25 @@ public interface Iamport {
@POST("/users/getToken")
Call<IamportResponse<AccessToken>> token(
@Body AuthData auth);

@GET("/payments/{imp_uid}/balance")
Call<IamportResponse<PaymentBalance>> balance_by_imp_uid(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid
);

@GET("/payments/{imp_uid}")
Call<IamportResponse<Payment>> payment_by_imp_uid(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid
);

@GET("/payments/status/{payment_status}")
Call<IamportResponse<PagedDataList<Payment>>> payments_by_status(
@Header("Authorization") String token,
@Path("payment_status") String payment_status
);

@POST("/payments/cancel")
Call<IamportResponse<Payment>> cancel_payment(
@Header("Authorization") String token,
Expand Down Expand Up @@ -69,25 +70,36 @@ Call<IamportResponse<BillingCustomer>> post_billing_customer(
@Path("customer_uid") String customer_uid,
@Body BillingCustomerData billing_data
);

@POST("/subscribe/payments/onetime")
Call<IamportResponse<Payment>> onetime_payment(
@Header("Authorization") String token,
@Body OnetimePaymentData onetime_data
);

@POST("/subscribe/payments/again")
Call<IamportResponse<Payment>> again_payment(
@Header("Authorization") String token,
@Body AgainPaymentData again_data
);


@GET("/subscribe/payments/schedule")
Call<IamportResponse<ScheduleList>> get_payment_schedule(
@Header("Authorization") String token,
// @Query("_token") String token,
@Query("schedule_from") int schedule_from,
@Query("schedule_to") int schedule_to,
@Query("schedule_status") String schedule_status,
@Query("page") int page,
@Query("limit") int limit
);

@POST("/subscribe/payments/schedule")
Call<IamportResponse<List<Schedule>>> schedule_subscription(
@Header("Authorization") String token,
@Body ScheduleData schedule_data
);

@POST("/subscribe/payments/unschedule")
Call<IamportResponse<List<Schedule>>> unschedule_subscription(
@Header("Authorization") String token,
Expand All @@ -99,14 +111,14 @@ Call<IamportResponse<BillingCustomer>> get_billing_customer(
@Header("Authorization") String token,
@Path("customer_uid") String customer_uid
);

/* 본인인증 결과 (certification result) */
@GET("/certifications/{imp_uid}")
Call<IamportResponse<Certification>> certification_by_imp_uid(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid
);

@POST("/escrows/logis/{imp_uid}")
Call<IamportResponse<EscrowLogisInvoice>> post_escrow_logis(
@Header("Authorization") String token,
Expand All @@ -119,32 +131,32 @@ Call<IamportResponse<List<NaverProductOrder>>> naver_product_orders(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid
);

@GET("/naver/product-orders/{product_order_id}")
Call<IamportResponse<NaverProductOrder>> naver_single_product_order(
@Header("Authorization") String token,
@Path("product_order_id") String product_order_id
);

@GET("/naver/reviews")
Call<IamportResponse<List<NaverReview>>> naver_reviews(
@Header("Authorization") String token
);

@POST("/payments/{imp_uid}/naver/cancel")
Call<IamportResponse<List<NaverProductOrder>>> naver_cancel(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid,
@Body NaverCancelData naver_cancel_data
);

@POST("/payments/{imp_uid}/naver/ship")
Call<IamportResponse<List<NaverProductOrder>>> naver_ship(
@Header("Authorization") String token,
@Path("imp_uid") String imp_uid,
@Body NaverShipData naver_ship_data
);

@POST("/payments/{imp_uid}/naver/place")
Call<IamportResponse<List<NaverProductOrder>>> naver_place(
@Header("Authorization") String token,
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/siot/IamportRestClient/IamportClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ public IamportResponse<Payment> againPayment(AgainPaymentData againData) throws
return response.body();
}

public IamportResponse<ScheduleList> getPaymentSchedule(GetScheduleData getScheduleData) throws IamportResponseException, IOException {
AccessToken auth = getAuth().getResponse();
Call<IamportResponse<ScheduleList>> call = this.iamport.get_payment_schedule(auth.getToken(),
getScheduleData.getSchedule_from(),
getScheduleData.getSchedule_to(),
getScheduleData.getSchedule_status(),
getScheduleData.getPage(),
getScheduleData.getLimit()
);

Response<IamportResponse<ScheduleList>> response = call.execute();
if ( !response.isSuccessful() ) throw new IamportResponseException( getExceptionMessage(response), new HttpException(response) );

return response.body();
}

public IamportResponse<List<Schedule>> subscribeSchedule(ScheduleData scheduleData) throws IamportResponseException, IOException {
AccessToken auth = getAuth().getResponse();
Call<IamportResponse<List<Schedule>>> call = this.iamport.schedule_subscription(auth.getToken(), scheduleData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class AgainPaymentData {
@SerializedName("vat")
private BigDecimal vat;

@SerializedName("currency")
private BigDecimal currency;

@SerializedName("name")
private String name;

Expand All @@ -37,6 +40,9 @@ public class AgainPaymentData {
@SerializedName("buyer_postcode")
private String buyer_postcode;

@SerializedName("browser_ip")
private String browser_ip;

@SerializedName("card_quota")
private int card_quota;

Expand Down Expand Up @@ -120,4 +126,12 @@ public ExtraNaverUseCfmEntry getExtra() {
public void setExtra(ExtraNaverUseCfmEntry extra) {
this.extra = extra;
}

public void setBrowser_ip(String browser_ip) {
this.browser_ip = browser_ip;
}

public void setCurrency(BigDecimal currency) {
this.currency = currency;
}
}
10 changes: 9 additions & 1 deletion src/main/java/com/siot/IamportRestClient/request/CardInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ public class CardInfo {
protected String expiry;
protected String birth;
protected String pwd_2digit;
protected String cvc;

public CardInfo(String card_number, String expiry, String birth, String pwd_2digit) {
this.card_number = card_number;
this.expiry = expiry;
this.birth = birth;
this.pwd_2digit = pwd_2digit;
}


public CardInfo(String card_number, String expiry, String birth, String pwd_2digit, String cvc) {
this.card_number = card_number;
this.expiry = expiry;
this.birth = birth;
this.pwd_2digit = pwd_2digit;
this.cvc = cvc;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.siot.IamportRestClient.request;

import com.google.gson.annotations.SerializedName;

public class GetScheduleData {

@SerializedName("schedule_from")
private int schedule_from;

@SerializedName("schedule_to")
private int schedule_to;

@SerializedName("schedule_status")
private String schedule_status;

@SerializedName("page")
private int page;

@SerializedName("limit")
private int limit;

public GetScheduleData(int schedule_from, int schedule_to, String schedule_status, int page, int limit) {
this.schedule_from = schedule_from;
this.schedule_to = schedule_to;
this.schedule_status = schedule_status;
this.page = page;
this.limit = limit;
}

public int getSchedule_from() {
return schedule_from;
}

public void setSchedule_from(int schedule_from) {
this.schedule_from = schedule_from;
}

public int getSchedule_to() {
return schedule_to;
}

public void setSchedule_to(int schedule_to) {
this.schedule_to = schedule_to;
}

public String getSchedule_status() {
return schedule_status;
}

public void setSchedule_status(String schedule_status) {
this.schedule_status = schedule_status;
}

public int getPage() {
return page;
}

public void setPage(int page) {
this.page = page;
}

public int getLimit() {
return limit;
}

public void setLimit(int limit) {
this.limit = limit;
}
}
Loading

0 comments on commit 9b466bc

Please sign in to comment.