public function testValidationFailsOnLongBankName() { $this->account->setBankName(str_repeat('T', 15)); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 0); $this->account->setBankName(str_repeat('T', 16)); $violations = Validator::validateBankAccount($this->account, null); $this->assertTrue(count($violations) === 1); $this->assertTrue(count($violations->get('bankName')) === 1); }
public function setUp() { parent::setUp(); $bankAccount = new BankAccount(); $bankAccount->setType(BankAccount::TYPE_NORMAL); $bankAccount->setBankName('ミツイスミトモ'); $bankAccount->setBankCode('0009'); $bankAccount->setBranchName('アカサカ'); $bankAccount->setBranchCode('825'); $bankAccount->setHolderName('スラビ'); $bankAccount->setNumber('9876543'); $bankAccount->setCompanyCode('1234560789'); $this->transaction = new MoneyTransferTransaction(); $this->transaction->setDestinationBankAccount($bankAccount); $this->transaction->setAmount(15234); }
public function setUp() { parent::setUp(); $senderBankAccount = new BankAccount(); $senderBankAccount->setType(BankAccount::TYPE_NORMAL); $senderBankAccount->setBankName('ミツイスミトモ'); $senderBankAccount->setBankCode('0009'); $senderBankAccount->setBranchName('アカサカ'); $senderBankAccount->setBranchCode('825'); $senderBankAccount->setHolderName('スラビ'); $senderBankAccount->setNumber('9876543'); $senderBankAccount->setCompanyCode('1234560789'); $this->transferRequest = new TransferRequest(); $this->transferRequest->setType(TransferRequest::TYPE_GENERAL); $this->transferRequest->setSourceBankAccount($senderBankAccount); $this->transferRequest->setDate(\DateTime::createFromFormat('Y-m-d', '2016-02-25')); $receiverBankAccount = new BankAccount(); $receiverBankAccount->setType(BankAccount::TYPE_NORMAL); $receiverBankAccount->setBankName('トウキョウトミン'); $receiverBankAccount->setHolderName('テストー.カブシキガイシャ'); //Note: using a normal dot/dash in this example $receiverBankAccount->setBankCode('0137'); $receiverBankAccount->setBranchName('シブヤ'); $receiverBankAccount->setBranchCode('031'); $receiverBankAccount->setNumber('1231990'); $receiverTransaction = new MoneyTransferTransaction(); $receiverTransaction->setDestinationBankAccount($receiverBankAccount); $receiverTransaction->setAmount(1103661); $this->transferRequest->addTransaction($receiverTransaction); $receiverBankAccount = new BankAccount(); $receiverBankAccount->setType(BankAccount::TYPE_NORMAL); $receiverBankAccount->setBankName('ベツバンク'); $receiverBankAccount->setHolderName('ヒトノナマエ'); //Note: using a normal dot/dash in this example $receiverBankAccount->setBankCode('0132'); $receiverBankAccount->setBranchName('イケブクロ'); $receiverBankAccount->setBranchCode('021'); $receiverBankAccount->setNumber('1331990'); $receiverTransaction = new MoneyTransferTransaction(); $receiverTransaction->setDestinationBankAccount($receiverBankAccount); $receiverTransaction->setAmount(657856); $this->transferRequest->addTransaction($receiverTransaction); }
$request->setDueDate(date('Y-m-d', time() + 7 * 24 * 60 * 60)); // Due date == issue date + 7 days $request->setPriceGross(123); $request->setCurrency('PLN'); $request->setNote('Test transaction from API'); $request->setNoRisk(true); $contractor = new Contractor(); $contractor->setName('Test contractor ' . uniqid()); $contractor->setTaxPayerNumber('8429067910'); $contractor->setCompanyGovId('146665640'); $contractor->setEmail('*****@*****.**'); $contractor->setFax('12312123'); $contractor->setPhone('234234234'); $contractor->setWww('www.esr24.pl'); $contractorAccount = new BankAccount(); $contractorAccount->setBankName('Test bank'); $contractorAccount->setNumber('PL123123123123123123123'); $contractor->setAccount($contractorAccount); $contractorAddress = new AddressData(); $contractorAddress->setStreet('Test street 1/2'); $contractorAddress->setCity('Testville'); $contractorAddress->setPostCode('00-111'); $contractorAddress->setCountryCode('PL'); $contractor->setAddress($contractorAddress); $request->setContractor($contractor); $pdf = new FileData(); $pdf->setFromFile(dirname(__FILE__) . '/../test.pdf'); $request->setDocument($pdf); $result = $client->createInvoice($request); Logger::info('Result is: {0}', $result); print_separator();
public function testMultiTransaction() { $transferRequest = new TransferRequest(); $transferRequest->setType(TransferRequest::TYPE_GENERAL); $transferRequest->setSourceBankAccount($this->account); $transferRequest->setDate(\DateTime::createFromFormat('Y-m-d', '2016-03-12')); $receiverBankAccount = new BankAccount(); $receiverBankAccount->setType(BankAccount::TYPE_CURRENT); $receiverBankAccount->setBankName('トウキョウトミン'); $receiverBankAccount->setHolderName('テストー.カブシキガイシャ'); //Note: using a normal dot/dash in this example $receiverBankAccount->setBankCode('0137'); $receiverBankAccount->setBranchName('シブヤ'); $receiverBankAccount->setBranchCode('031'); $receiverBankAccount->setNumber('1231990'); $violations = Validator::validateBankAccount($receiverBankAccount, Validator::BANK_ACCOUNT_ROLE_RECEIVER); $this->assertTrue(count($violations) === 0); $receiverTransaction = new MoneyTransferTransaction(); $receiverTransaction->setDestinationBankAccount($receiverBankAccount); $receiverTransaction->setAmount(1103661); $violations = Validator::validateMoneyTransferTransaction($receiverTransaction); $this->assertTrue(count($violations) === 0); $transferRequest->addTransaction($receiverTransaction); $receiverBankAccount = new BankAccount(); $receiverBankAccount->setType(BankAccount::TYPE_NORMAL); $receiverBankAccount->setBankName('ミツビシトウキョウUFJ'); $receiverBankAccount->setHolderName('カ)ゼンギン'); //Note: using a normal dot in this example $receiverBankAccount->setBankCode('0005'); $receiverBankAccount->setBranchName('ギンザドオリ'); $receiverBankAccount->setBranchCode('024'); $receiverBankAccount->setNumber('2275535'); $violations = Validator::validateBankAccount($receiverBankAccount, Validator::BANK_ACCOUNT_ROLE_RECEIVER); $this->assertTrue(count($violations) === 0); $receiverTransaction = new MoneyTransferTransaction(); $receiverTransaction->setDestinationBankAccount($receiverBankAccount); $receiverTransaction->setAmount(599300); $violations = Validator::validateMoneyTransferTransaction($receiverTransaction); $this->assertTrue(count($violations) === 0); $transferRequest->addTransaction($receiverTransaction); $zenginContentShiftJis = $this->generator->generate($transferRequest); //Let's verify that ミツビシトウキョウUFJ "small" (full-width + latin + small voiced) is converted correctly. //We do compare to the result file below, but we'd like to explicitly check for this beforehand anyway. $zenginContentUtf = \mb_convert_encoding($zenginContentShiftJis, 'utf-8', 'cp932'); $this->assertTrue(str_replace('ミツビシトウキヨウUFJ', '', $zenginContentUtf) !== $zenginContentUtf); $this->assertTrue(str_replace(1103661 + 599300, '', $zenginContentUtf) !== $zenginContentUtf, "Cannot find total amount."); $this->validateZenginContent($zenginContentShiftJis, 'results/multi-transaction.txt'); }