Created
          February 19, 2020 11:25 
        
      - 
      
- 
        Save akoSalman/12374857d246afff3c9589ffefbe46b3 to your computer and use it in GitHub Desktop. 
    Rubika Token
  
        
  
    
      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 characters
    
  
  
    
  | function noToken() { | |
| return typeof rubika_token === typeof undefined; | |
| } | |
| function hasRubikaToken() { | |
| return !noToken(); | |
| } | |
| function isFromRubika() { | |
| return !notRubika(); | |
| } | |
| function notRubika() { | |
| return typeof androidApp === typeof undefined; | |
| } | |
| function settleRubikaPayment() { | |
| $.ajax({ | |
| type: 'POST', | |
| url: '/settle_rubika_payment', | |
| data: {order: order_id}, | |
| success: function (res) { | |
| $("#final-payment-btn") | |
| .prop("disabaled", true) | |
| .addClass("gray-background") | |
| .removeClass("green-background") | |
| .text("پرداخت با موفقیت انجام شد.") | |
| }, | |
| error: function (res) { | |
| alert("خطایی اتفاق افتاده.") | |
| } | |
| }) | |
| } | |
| $(document).ready(function () { | |
| if (notRubika()) { | |
| rubika_token = "2648avkciwlobyqkqyveensrguuhixhl"; | |
| } else { | |
| rubika_token = androidApp.getUserToken(); | |
| } | |
| }); | |
| function clientResponse(s) { | |
| var res = JSON.parse(s); | |
| if (res.track_id == order_id) { | |
| settleRubikaPayment(); | |
| } | |
| } | |
| function goBack() { | |
| if (isFromRubika()) { | |
| androidApp.stopGoBack(); | |
| window.history.back(); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment