app/models/perfect_money_merchant/account.rb
def transfer!(payee_account, amount)
			if payee_account =~ /\A([UE])\d{7}\z/
				currency = $1 == 'U' ? 'usd' : 'eur'
				unit = units.where(currency: currency).where('balance > ?', amount).order('balance DESC').take(1).first
				if unit.nil?
					exception = BasicError.new('no unit was found')
					exception.add_error(:unit, :not_found)
					raise exception
				else
					unit.transfer!(payee_account, amount).tap do |params|
						sync_with_pm_server
						Payment.create(
							payment_batch_num: params.payment_batch_num,
							payment_id: params.payment_id,
							payment_amount: params.payment_amount,
							payer_account: params.payer_account,
							payee_account: params.payee_account
						)
					end
				end
			else
				exception = BasicError.new('invalid payee_account')
				exception.add_error(:payee_account, :invalid)
				raise exception
			end
		end
# Transfer money to whatever perfect money account
# @param [String] payee_account payee account code number
# @param [Float] amount amount of money
# @return [Hash] Perfect Money http response body
Transfer money to whatever perfect money account
Transfer money to whatever perfect money account
def transfer!(payee_account, amount)
			if payee_account =~ /\A([UE])\d{7}\z/
				currency = $1 == 'U' ? 'usd' : 'eur'
				unit = units.where(currency: currency).where('balance > ?', amount).order('balance DESC').take(1).first
				if unit.nil?
					exception = BasicError.new('no unit was found')
					exception.add_error(:unit, :not_found)
					raise exception
				else
					unit.transfer!(payee_account, amount).tap do |params|
						sync_with_pm_server
						Payment.create(
							payment_batch_num: params.payment_batch_num,
							payment_id: params.payment_id,
							payment_amount: params.payment_amount,
							payer_account: params.payer_account,
							payee_account: params.payee_account
						)
					end
				end
			else
				exception = BasicError.new('invalid payee_account')
				exception.add_error(:payee_account, :invalid)
				raise exception
			end
		end
def transfer! ( payee_account , amount ) if payee_account =~ / \A ([UE]) \d {7} \z / currency = $1 == 'U' ? 'usd' : 'eur' unit = units . where ( currency : currency ) . where ( 'balance > ?' , amount ) . order ( 'balance DESC' ) . take ( 1 ) . first if unit . nil? exception = BasicError . new ( 'no unit was found' ) exception . add_error ( :unit , :not_found ) raise exception else unit . transfer! ( payee_account , amount ) . tap do | params | sync_with_pm_server Payment . create ( payment_batch_num : params . payment_batch_num , payment_id : params . payment_id , payment_amount : params . payment_amount , payer_account : params . payer_account , payee_account : params . payee_account ) end end else exception = BasicError . new ( 'invalid payee_account' ) exception . add_error ( :payee_account , :invalid ) raise exception end end
Transfer money to whatever perfect money account
Transfer money to whatever perfect money account
Perfect Money http response body
Perfect Money http response body
Hash
payee_account
amount
amount amount of money
amount amount of money