Skip to content

custom URL scheme 형태로 app_scheme 수정 #258

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion exampleForExpo/src/PaymentTest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default function PaymentTest({ navigation }) {
merchant_uid: merchantUid,
name,
amount,
app_scheme: 'exampleforexpo',
app_scheme: 'exampleforexpo://',
tax_free: undefined,
buyer_name: buyerName,
buyer_tel: buyerTel,
Expand Down
2 changes: 1 addition & 1 deletion exampleForManagedExpo/src/PaymentTest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default function PaymentTest({ navigation }) {
merchant_uid: merchantUid,
name,
amount,
app_scheme: 'exampleformanagedexpo',
app_scheme: 'exampleformanagedexpo://',
tax_free: undefined,
buyer_name: buyerName,
buyer_tel: buyerTel,
Expand Down
10 changes: 5 additions & 5 deletions exampleForWebView/manuals/CERTIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

return (
<WebView
source={{ uri: domain }}
source={{ uri: domain }}
onMessage={onMessage}
style={{ flex: 1 }}
injectedJavascript={`(function() {
Expand Down Expand Up @@ -122,7 +122,7 @@
/* 가맹점 식별코드, 본인인증 데이터 추출 */
const userCode = navigation.getParam('userCode');
const data = navigation.getParam('data');

/* 본인인증 후 실행될 콜백 함수 입력 */
function callback(response) {
const isSuccessed = getIsSuccessed(response);
Expand Down Expand Up @@ -151,7 +151,7 @@
userCode={userCode}
data={{
...data,
app_scheme: 'test',
app_scheme: 'test://',
}}
callback={callback}
/>
Expand Down Expand Up @@ -191,7 +191,7 @@
const { type } = query;
if (type === 'certification') {
/* 본인인증 후 렌더링 되었을 경우, https://example.com/certification/result로 리디렉션 시킨다 */
setUri(`${domain}/certification/result?${query}`);
setUri(`${domain}/certification/result?${query}`);
}
...
}
Expand All @@ -207,7 +207,7 @@

return (
<WebView
source={{ uri }}
source={{ uri }}
onMessage={onMessage}
style={{ flex: 1 }}
injectedJavascript={`(function() {
Expand Down
10 changes: 5 additions & 5 deletions exampleForWebView/manuals/PAYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

return (
<WebView
source={{ uri: domain }}
source={{ uri: domain }}
onMessage={onMessage}
style={{ flex: 1 }}
injectedJavascript={`(function() {
Expand Down Expand Up @@ -129,7 +129,7 @@
/* 가맹점 식별코드, 결제 데이터 추출 */
const userCode = navigation.getParam('userCode');
const data = navigation.getParam('data');

/* 결제 후 실행될 콜백 함수 입력 */
function callback(response) {
const isSuccessed = getIsSuccessed(response);
Expand Down Expand Up @@ -160,7 +160,7 @@
userCode={userCode}
data={{
...data,
app_scheme: 'exampleForWebView',
app_scheme: 'exampleForWebView://',
}}
callback={callback}
/>
Expand Down Expand Up @@ -200,7 +200,7 @@
const { type } = query;
if (type === 'payment') {
/* 결제 후 렌더링 되었을 경우, https://example.com/payment/result로 리디렉션 시킨다 */
setUri(`${domain}/payment/result?${query}`);
setUri(`${domain}/payment/result?${query}`);
}
...
}
Expand All @@ -216,7 +216,7 @@

return (
<WebView
source={{ uri }}
source={{ uri }}
onMessage={onMessage}
style={{ flex: 1 }}
injectedJavascript={`(function() {
Expand Down
2 changes: 1 addition & 1 deletion exampleForWebView/src/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Payment({navigation, route}: Props) {
loading={<Loading />}
data={{
...data,
app_scheme: 'exampleforwebview',
app_scheme: 'exampleforwebview://',
}}
callback={callback}
/>
Expand Down
2 changes: 1 addition & 1 deletion manuals/EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function Payment({ navigation }) {
buyer_email: '[email protected]',
buyer_addr: '서울시 강남구 신사동 661-16',
buyer_postcode: '06018',
app_scheme: 'example',
app_scheme: 'example://',
// [Deprecated v1.0.3]: m_redirect_url
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Payment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
const queryParameters = iamportUrl.getQuery();
const scheme = iamportUrl.scheme;
let niceTransRedirectionUrl;
if (scheme === data.app_scheme?.toLowerCase()) {
if (data.app_scheme?.split('://')[0].toLowerCase() === scheme) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.scheme = url.split('://', 1)[0];

IamportUrl 클래스에서 scheme을 처리하는 방식과 유사하게 app_scheme을 가공하는 로직입니다.

if (queryParameters.callbackparam1 != null) {
niceTransRedirectionUrl = queryParameters.callbackparam1;
}
Expand Down