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
server.get('/downloadPdf/:fileData', function (req, res) { | |
// config | |
var fileData = Buffer.from(req.params.fileData, 'base64'); | |
var menuData = JSON.parse(fileData.toString()); | |
var userName = menuData.userName; | |
var menuName = slug(menuData.menuName); | |
var fileName = userName + "-" + menuName + PDF_EXT; | |
var filePath = PDF_PATH + fileName; | |
// process headers |
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
import { Injectable } from '@angular/core'; | |
import { Observable, Subscription } from 'rxjs'; | |
import { InputMask } from 'primeng/primeng'; | |
@Injectable() | |
export class ClientScreenService { | |
inputMaskStream: Subscription; | |
isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); | |
isDesktop: boolean = false; |
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
import { Injectable, isDevMode } from '@angular/core'; | |
import { ConnectionBackend, Http, URLSearchParams, Headers, RequestOptions, | |
RequestOptionsArgs, Response, RequestMethod } from '@angular/http'; | |
import { ToastrService } from 'ngx-toastr'; | |
import { Observable } from 'rxjs/Observable'; | |
import * as _ from 'lodash'; | |
import { StorageService } from './storage.service'; | |
import { TokenService } from './token.service'; | |
import { TranslateService } from '../translations/translate.service'; |
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
describe Payment do | |
let(:payment) { create(:payment) } | |
let(:payment_with_order) { create(:payment, :with_future_order) } | |
context 'state machine' do | |
it 'is in pending state on creation' do | |
expect(payment.pending?).to eq true | |
end | |
it 'transfers to completed state with #complete' do |
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
# == Schema Information | |
# | |
# Table name: orders | |
# | |
# id :integer not null, primary key | |
# user_id :integer | |
# product_id :integer | |
# quantity :integer | |
# payment_kind :string | |
# aasm_state :string |
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
require 'base64' | |
## | |
# A class for encoding and decoding auth information in form of JWT token. Note that only sensitive auth information | |
# such as user id and/or email should be encrypted in token, not any possible api payload | |
# @example Encrypt user's id and email | |
# JwtCrypto.encode({ user: { id: 1, email: 'hello@hello.com' }}) # => returns JWT token | |
# @example Decode payload from provided JWT token | |
# JwtCrypto.decode('hhjkasdhkja.hdjsakdhak.hasjdkhasjkd') # => returns decoded payload or fails with DecodeError | |
class JwtCrypto |