Skip to content

Commit e5aa2e6

Browse files
author
ehowlsla
committed
removewindow 추가
1 parent dd98549 commit e5aa2e6

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
/local.properties
44
*.idea
55
.DS_Store
6+
bootpay/build/
7+
sample/build/
68
build/
79
/captures
810
.externalNativeBuild
11+
*.class
12+
*.jar
13+
*.dex

bootpay/src/main/java/kr/co/bootpay/Bootpay.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ public static void finish() {
2626
public static void confirm(String data) {
2727
if (builder != null) builder.transactionConfirm(data);
2828
}
29+
30+
public static void removePaymentWindow() {
31+
if (builder != null) builder.removePaymentWindow();
32+
}
2933
}

bootpay/src/main/java/kr/co/bootpay/BootpayDialog.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ private void transactionConfirm(String data) {
6868
bootpay.transactionConfirm(data);
6969
}
7070

71+
private void removePaymentWindow() {
72+
if (bootpay != null)
73+
bootpay.removePaymentWindow();
74+
}
75+
7176
public static class Builder {
7277
private FragmentManager fragmentManager;
7378
private Request result = new Request();
@@ -377,6 +382,11 @@ public void transactionConfirm(String data) {
377382
dialog.transactionConfirm(data);
378383
}
379384

385+
public void removePaymentWindow() {
386+
if (dialog != null)
387+
dialog.removePaymentWindow();
388+
}
389+
380390
private boolean isEmpty(String value) {
381391
return value == null || value.length() == 0;
382392
}

bootpay/src/main/java/kr/co/bootpay/BootpayWebView.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ internal class BootpayWebView @JvmOverloads constructor(context: Context, attrs:
260260
load("window.BootPay.transactionConfirm(JSON.parse('${data ?: ""}'));")
261261
}
262262

263+
fun removePaymentWindow() {
264+
load("window.BootPay.removePaymentWindow();")
265+
}
266+
263267
// private fun items() = "items:${
264268
// request?.items?.map { "{item_name:${it.name},qty:${it.qty},unique:'${it.unique}',price:${it.price}},cat1:${it.cat1},cat2:${it.cat2},cat3:${it.cat3}," }?.dropLast(2)
265269
// }"

sample/src/main/java/bootpay/co/kr/samplepayment/MainActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
public class MainActivity extends AppCompatActivity {
2525

26-
private int stuck = 10;
26+
private int stuck = 0;
2727

2828
@Override
2929
protected void onCreate(Bundle savedInstanceState) {
@@ -63,7 +63,7 @@ public void onClick_request(View v) {
6363
.setApplicationId("59a7e647396fa64fcad4a8c2") // 해당 프로젝트(안드로이드)의 application id 값
6464
.setPG(PG.DANAL) // 결제할 PG 사
6565
.setUserPhone("010-1234-5678") // 구매자 전화번호
66-
.setMethod(Method.VBANK) // 결제수단
66+
.setMethod(Method.PHONE) // 결제수단
6767
.setName("맥북프로임다") // 결제할 상품명
6868
.setOrderId("1234") // 결제 고유번호
6969
.setQuotas(new int[] {0,2,3}) // 일시불, 2개월, 3개월 할부 허용, 할부는 최대 12개월까지 사용됨 (5만원 이상 구매시 할부허용 범위)
@@ -74,6 +74,7 @@ public void onClick_request(View v) {
7474
@Override
7575
public void onConfirm(@Nullable String message) {
7676
if (0 < stuck) Bootpay.confirm(message); // 재고가 있을 경우.
77+
else Bootpay.removePaymentWindow(); // 재고가 없어 중간에 결제창을 닫고 싶을 경우
7778
Log.d("confirm", message);
7879
}
7980
})

0 commit comments

Comments
 (0)