Last active
April 18, 2018 06:53
-
-
Save yonjah/8b599a13f8c7555b0ae6ac6ec1ae3dd9 to your computer and use it in GitHub Desktop.
Revisions
-
yonjah revised this gist
Apr 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ async function chargeCreate ({ amount, source, description, currency }) { myTraceService.log(`New charge ${charge.amount}`); return charge; } catch (e) { // do something with the error if you want to throw e; } } -
yonjah revised this gist
Apr 18, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ async function chargeCreate ({ amount, source, description, currency }) { //do some stuff before the function await someService.doAsyncStuff(amount, currency, description); try { const charge = await stripe.charges.create.apply(stripe.charges, arguments); //do some stuff after the function myTraceService.log(`New charge ${charge.amount}`); return charge; -
yonjah created this gist
Apr 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ async function chargeCreate ({ amount, source, description, currency }) { //do some stuff before the function await someService.doAsyncStuff(amount, currency, description); try { const charge = await stripe.charges.create({ amount, source, description, currency }); //do some stuff after the function myTraceService.log(`New charge ${charge.amount}`); return charge; } catch (e) { // do some thing with the error if you want to throw e; } } // No changes on the processPayement async function processPayement (amount, source, description) { let charge; try { charge = await chargeCreate({ amount, source, description, currency: "usd" }); } catch (e) { // Error handling } // ... }