File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,6 @@ function validateWithAppStore(url, receipt) {
3737 return fulfill ( ) ;
3838 }
3939 // receipt is from test and should go to test
40- if ( status == 21007 ) {
41- return validateWithAppStore ( IAP_SANDBOX_URL ) ;
42- }
4340 return reject ( body ) ;
4441 } ) ;
4542 } ) ;
@@ -82,11 +79,30 @@ export class IAPValidationRouter extends PromiseRouter {
8279 if ( process . env . NODE_ENV == "test" && req . body . bypassAppStoreValidation ) {
8380 return getFileForProductIdentifier ( productIdentifier , req ) ;
8481 }
82+
83+ function successCallback ( ) {
84+ return getFileForProductIdentifier ( productIdentifier , req ) ;
85+ } ;
86+
87+ function errorCallback ( error ) {
88+ return Promise . resolve ( { response : appStoreError ( error . status ) } ) ;
89+ }
8590
8691 return validateWithAppStore ( IAP_PRODUCTION_URL , receipt ) . then ( ( ) => {
87- return getFileForProductIdentifier ( productIdentifier , req ) ;
92+
93+ return successCallback ( ) ;
94+
8895 } , ( error ) => {
89- return Promise . resolve ( { response : appStoreError ( error . status ) } ) ;
96+ if ( error . status == 21007 ) {
97+ return validateWithAppStore ( IAP_SANDBOX_URL , receipt ) . then ( ( ) => {
98+ return successCallback ( ) ;
99+ } , ( error ) => {
100+ return errorCallback ( error ) ;
101+ }
102+ ) ;
103+ }
104+
105+ return errorCallback ( error ) ;
90106 } ) ;
91107 }
92108
You can’t perform that action at this time.
0 commit comments