Exemplo n.º 1
0
  async retrieve (user: User, paymentReference: string): Promise<PaymentRetrieveResponse | undefined> {
    /*
    Calculated from:
     dependencies
      | where name contains "GET /card-payments"
      | summarize avg(duration)
     */
    const payRetrieveDelayInMs = 681
    await delay(payRetrieveDelayInMs)

    return Promise.resolve(
      {
        amount: 185,
        description: description,
        reference: paymentReference,
        currency: 'GBP',
        caseReference: uuid(),
        channel: 'online',
        method: 'card',
        externalProvider: 'gov pay',
        status: 'Success',
        externalReference: 'a-gov-pay-reference',
        siteId: siteId,
        serviceName: serviceName,
        fees: [
          { calculated_amount: 185, code: 'X0029', version: '1' }
        ]
      })
  }
Exemplo n.º 2
0
export const addRequestReducer = (state = initialState, action: Action) => {
  switch (action.type) {
    case UPDATE_REQUEST_FIELDS:
      return {
        ...state,
        fields: {
          ...state.fields,
          ...action.payload
        }
      };
    case UPDATE_REQUEST_ROOT_FIELDS:
      return {
        ...state,
        ...action.payload
      };
    case RESET:
      return {
        ...initialState,
        fields: {
          ...initialState.fields,
          requestId: uuid().replace(/-/g, "")
        }
      };

    default:
      return state;
  }
};
Exemplo n.º 3
0
  static forLogin (req: express.Request,
                   res: express.Response,
                   receiver: RoutablePath = Paths.receiver): string {
    const redirectUri = buildURL(req, receiver.uri)
    const state = uuid()
    OAuthHelper.storeStateCookie(req, res, state)

    return `${loginPath}?response_type=code&state=${state}&client_id=${clientId}&redirect_uri=${redirectUri}`
  }
Exemplo n.º 4
0
export function createClaimData (claimantType: PartyType, defendantType: PartyType, hasEmailAddress: boolean = true,
                                 interestType: InterestType = InterestType.STANDARD): ClaimData {
  let claimData = {
    claimants: [createClaimant(claimantType)],
    defendants: [createDefendant(defendantType, hasEmailAddress)],
    payment: {
      amount: claimFee * 100,
      reference: 'RC-1524-6488-1670-7520',
      status: 'success'
    },
    feeAmountInPennies: claimFee * 100,
    amount: claimAmount,
    interest: {
      type: 'no interest'
    },
    reason: claimReason,
    timeline: { rows: [{ date: 'may', description: 'ok' }] },
    externalId: uuid(),
    get total (): number {
      switch (interestType) {
        case InterestType.STANDARD:
          return this.amount.getClaimTotal() + claimFee
        case InterestType.BREAKDOWN:
          return this.amount.getClaimTotal() + fixedInterestAmount + claimFee
      }
    },
    moneyReceivedOn: null
  } as ClaimData

  switch (interestType) {
    case InterestType.BREAKDOWN:
      claimData.interest = {
        type: 'breakdown',
        interestBreakdown: {
          totalAmount: fixedInterestAmount,
          explanation: 'up to today'
        },
        specificDailyAmount: dailyInterestAmount
      }
      claimData.interest.interestDate = {
        endDateType: 'settled_or_judgment'
      }
      break
    case InterestType.STANDARD:
      claimData.interest = {
        type: 'standard',
        rate: 8
      }
      claimData.interest.interestDate = {
        type: 'submission'
      }
      break
  }

  return claimData
}
Exemplo n.º 5
0
	router.get('/signin/twitter', async ctx => {
		const twCtx = await twAuth.begin();

		const sessid = uuid();

		redis.set(sessid, JSON.stringify(twCtx));

		const expires = 1000 * 60 * 60; // 1h
		ctx.cookies.set('signin_with_twitter_session_id', sessid, {
			path: '/',
			domain: config.host,
			secure: config.url.startsWith('https'),
			httpOnly: true,
			expires: new Date(Date.now() + expires),
			maxAge: expires
		});

		ctx.redirect(twCtx.url);
	});
Exemplo n.º 6
0
Arquivo: fs.ts Projeto: domojs/lifttt
 executeTrigger: async function (trigger)
 {
     switch (trigger.name)
     {
         case 'watch':
             var stat = await promisify(fs.stat)(trigger.params['path'] as string);
             if (stat.isDirectory() || stat.isFile())
             {
                 var id = uuid();
                 var watcher = fs.watch(trigger.params['path'] as string, function (event, fileName)
                 {
                     if (!trigger.params['event'] || trigger.params['event'] == event)
                         server.trigger({ id: id, data: { path: fileName, mtime: new Date().toJSON() } });
                 });
                 registeredTriggers[id] = watcher;
             }
             break;
     }
     return null;
 }
  private addSlackButtons(f: IQueryResponseField, row: IQueryResponseRow, attachment: IAttachment) {

    if (!SlackUtils.slackButtonsEnabled) { return }

    const d = row[f.name]
    if (!d.links) { return }

    const usableActions = d.links.filter((l) => (l.type === "action") && !l.form && !l.form_url)
    if (!(usableActions.length > 0)) { return }

    attachment.actions = usableActions.map((link) => {
      return {
        name: "data_action",
        text: link.label,
        type: "button",
        value: JSON.stringify({lookerUrl: this.options.baseUrl, action: link}),
      }
    })
    attachment.callback_id = uuid()

  }
Exemplo n.º 8
0
import * as uuid from "uuid";

import { newRequest, Action } from "../types";
import { RESET, UPDATE_REQUEST_FIELDS, UPDATE_REQUEST_ROOT_FIELDS } from "../actions/addRequest";

export const initialState: newRequest = {
  fields: {
    url: "",
    method: "GET",
    type: "xmlhttprequest",
    requestId: uuid().replace(/-/g, "")
  },
  error: ""
};

export const addRequestReducer = (state = initialState, action: Action) => {
  switch (action.type) {
    case UPDATE_REQUEST_FIELDS:
      return {
        ...state,
        fields: {
          ...state.fields,
          ...action.payload
        }
      };
    case UPDATE_REQUEST_ROOT_FIELDS:
      return {
        ...state,
        ...action.payload
      };
    case RESET:
Exemplo n.º 9
0
 constructor(attrs: any) {
   this.id = uuid();
   this.start = moment.tz(attrs.start, attrs.timezone || 'Europe/Berlin');
   this.duration = attrs.duration;
   this.isAllDay = attrs.isAllDay || false;
 }
Exemplo n.º 10
0
 rename: (name) => {
   return `${name}-${uuid()}`
 },