O
O
Oleg2015-02-18 09:50:50
Node.js
Oleg, 2015-02-18 09:50:50

How to properly implement Robokassa on Angular + Nodejs API?

Good afternoon. Has anyone set up payment through a robokassa on an angular/node? I did not quite understand their strange documentation, what should be transferred where.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2017-10-25
@1na1

Hey!
In my opinion, it is better to feel the first letter using the means of a programming language, and not regular expressions. This will come out clearer and more productive.

  1. Read first character from string
  2. Modify a string - use the regular expression "s/\D//g" to remove from the string everything that is not a number
  3. Check what the first character was
  4. If the first character was "F" - return it to the string using concatenation
perl example
#!/usr/bin/perl -w

$one = 'qwF12F3gh'; # Считываем примеры
$two = 'FqwF12F3gh'; # В переменные

for $example ($one, $two){ # Проходимся по обоим примерам в цикле
  $first = substr($example, 0, 1); # Считываем первый символ в переменную $first
  $example =~ s/\D//g; # Удаляем из строки все, что не является числом
    
  if($first eq 'F'){ # Если первый символ равен "F"
    $example = 'F' . $example; # Возвращаем его обратно в строку 
  }
}

print 'qwF12F3gh', ' -> ', $one;
print 'FqwF12F3gh', ' -> ', $two;

# Результат 
# qwF12F3gh -> 123
# FqwF12F3gh -> F123

V
vaskon93, 2017-10-25
@vaskon93

in php you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question