Skip to content

Commit

Permalink
Merge pull request #18 from iamport/feature/delete-billing-data
Browse files Browse the repository at this point in the history
[PCM-426] DELETE /subscribe/customers/{customer_uid} API 추가
  • Loading branch information
anymate98 authored Jan 3, 2022
2 parents aa3e9cc + ede8de4 commit 0b8c68d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
14 changes: 9 additions & 5 deletions src/main/java/com/siot/IamportRestClient/Iamport.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
import com.siot.IamportRestClient.response.naver.NaverReview;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.*;

public interface Iamport {

Expand Down Expand Up @@ -59,6 +55,14 @@ Call<IamportResponse<Prepare>> get_prepare(
@Path("merchant_uid") String merchant_uid
);

@DELETE("/subscribe/customers/{customer_uid}")
Call<IamportResponse<BillingCustomer>> delete_billing_customer(
@Header("Authorization") String token,
@Path("customer_uid") String customer_uid,
@Query("reason") String reason,
@Query("extra[requester]") String extra
);

@POST("/subscribe/customers/{customer_uid}")
Call<IamportResponse<BillingCustomer>> post_billing_customer(
@Header("Authorization") String token,
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/com/siot/IamportRestClient/IamportClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,19 @@ public IamportResponse<Prepare> getPrepare(String merchantUid) throws IOExceptio
return response.body();
}

public IamportResponse<BillingCustomer> post_billing_customer(String customer_uid, BillingCustomerData billingData) throws IOException, IamportResponseException {
public IamportResponse<BillingCustomer> deleteBillingCustomer(String customerUid, String reason, String extra) throws IOException, IamportResponseException {
AccessToken auth = getAuth().getResponse();
Call<IamportResponse<BillingCustomer>> call = this.iamport.post_billing_customer(auth.getToken(), customer_uid, billingData);
Call<IamportResponse<BillingCustomer>> call = this.iamport.delete_billing_customer(auth.getToken(), customerUid, reason, extra);

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

return response.body();
}

public IamportResponse<BillingCustomer> postBillingCustomer(String customerUid, BillingCustomerData billingData) throws IOException, IamportResponseException {
AccessToken auth = getAuth().getResponse();
Call<IamportResponse<BillingCustomer>> call = this.iamport.post_billing_customer(auth.getToken(), customerUid, billingData);

Response<IamportResponse<BillingCustomer>> response = call.execute();
if( !response.isSuccessful() ) throw new IamportResponseException( getExceptionMessage(response), new HttpException(response) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

public class BillingCustomerData {

@SerializedName("customer_uid")
private String customer_uid;

@SerializedName("pg")
private String pg;

Expand Down Expand Up @@ -41,16 +38,11 @@ public class BillingCustomerData {
private String customer_postcode;

public BillingCustomerData(String customer_uid, String card_number, String expiry, String birth) {
this.customer_uid = customer_uid;
this.card_number = card_number;
this.expiry = expiry;
this.birth = birth;
}

public void setCustomerUid(String customer_uid) {
this.customer_uid = customer_uid;
}

public void setPg(String pg) {
this.pg = pg;
}
Expand Down Expand Up @@ -95,10 +87,6 @@ public void setCustomerPostcode(String customer_postcode) {
this.customer_postcode = customer_postcode;
}

public String getCustomerUid() {
return customer_uid;
}

public String getPg() {
return pg;
}
Expand Down

0 comments on commit 0b8c68d

Please sign in to comment.