/** * @return Line */ public function getLine() { $line = new Line(); $line->setColumnDelimiter(""); $columns = ['record_type' => PresetStringColumnFactory::create('9', $label = 'record_type'), 'no_trans' => LeftPaddedZerofillStringColumnFactory::create($this->getBeneficiaryCount(), $length = 8, $label = 'no_trans'), 'ttl_payment_amt' => LeftPaddedDecimalWithoutDelimiterColumnFactory::create($this->getTotalPaymentAmount(), $length = 15, $label = 'ttl_payment_amt'), 'filler' => RightPaddedStringColumnFactory::create('', $length = 876, $label = 'filler')]; $line->setColumns($columns); return $line; }
public function testLeftPaddedDecimalWithoutDelimiterColumn() { $column = LeftPaddedDecimalWithoutDelimiterColumnFactory::create(100, 6); $this->assertEquals('010000', $column->getString()); $column = LeftPaddedDecimalWithoutDelimiterColumnFactory::create(97.53, 5); $this->assertEquals('09753', $column->getString()); $column = LeftPaddedDecimalWithoutDelimiterColumnFactory::create(97.5312, 5); $this->assertEquals('09753', $column->getString()); }
/** * @param BeneficiaryAdapterInterface * @param String The key to read the config from */ public static function cashiersOrderFormatPaymentInstructionLine(BeneficiaryAdapterInterface $beneficiary, $config_key) { $line = new Line($config_key); $line->setColumnDelimiter(""); $date_column = new DateColumn(); $date_column->setDate(static::getNextWorkingDay()); $date_column->setFormat('Ymd'); $settlement_ac_no = ConfigurableStringColumnFactory::create($config = $line->config, 'settlement_ac_no')->getString(); $columns = ['record_type' => PresetStringColumnFactory::create('2', $label = 'record_type'), 'payment_type' => PresetStringColumnFactory::create('CHQ', $label = 'payment_type'), 'payment_currency' => ConfigurableStringColumnFactory::create($config = $line->config, 'payment_currency', $label = 'payment_currency'), 'payment_amt' => LeftPaddedDecimalWithoutDelimiterColumnFactory::create($beneficiary->getPaymentAmount(), $fixed_length = 15, $label = 'payment_amt'), 'value_date' => RightPaddedStringColumnFactory::create($date_column->getString(), 8, $label = 'value_date'), 'beneficiary_name1' => RightPaddedStringColumnFactory::create($beneficiary->getName1(), $max_length = 35, $label = 'beneficiary_name1'), 'beneficiary_name2' => RightPaddedStringColumnFactory::create($beneficiary->getName2(), $max_length = 35, $label = 'beneficiary_name2'), 'beneficiary_name3' => RightPaddedStringColumnFactory::create($beneficiary->getName3(), $max_length = 35, $label = 'beneficiary_name3'), 'beneficiary_add1' => RightPaddedStringColumnFactory::create($beneficiary->getAddress1(), $max_length = 35, $label = 'beneficiary_add1'), 'beneficiary_add2' => RightPaddedStringColumnFactory::create($beneficiary->getAddress2(), $max_length = 35, $label = 'beneficiary_add2'), 'beneficiary_add3' => RightPaddedStringColumnFactory::create($beneficiary->getAddress3(), $max_length = 35, $label = 'beneficiary_add3'), 'beneficiary_postcode' => RightPaddedStringColumnFactory::create($beneficiary->getPostcode(), 15, $label = 'beneficiary_postcode'), 'beneficiary_countrycode' => RightPaddedStringColumnFactory::create($line->config->get('beneficiary_countrycode'), $length = 3, $label = 'beneficiary_countrycode'), 'filler' => RightPaddedStringColumnFactory::create('', 6, $label = 'filler'), 'settlement_ac_no' => LeftPaddedZerofillStringColumnFactory::create($settlement_ac_no, 20, $label = 'settlement_ac_no'), 'currency' => ConfigurableStringColumnFactory::create($config = $line->config, 'payment_currency', $label = 'currency'), 'handling_opt' => PresetStringColumnFactory::create('M', $label = 'handling_opt'), 'mail_to_party' => PresetStringColumnFactory::create('BEN', $label = 'mail_to_party'), 'mail_name_add1' => RightPaddedStringColumnFactory::create('', 35, $label = 'mail_name_add1'), 'mail_name_add2' => RightPaddedStringColumnFactory::create('', 35, $label = 'mail_name_add2'), 'mail_name_add3' => RightPaddedStringColumnFactory::create('', 35, $label = 'mail_name_add3'), 'mail_name_add4' => RightPaddedStringColumnFactory::create('', 35, $label = 'mail_name_add4'), 'mail_postcode' => RightPaddedStringColumnFactory::create('', 15, $label = 'mail_postcode'), 'mail_countrycode' => RightPaddedStringColumnFactory::create('', 3, $label = 'mail_countrycode'), 'filler1' => RightPaddedStringColumnFactory::create('', 50, $label = 'filler1'), 'payment_indicator' => RightPaddedStringColumnFactory::create('', 1, $label = 'payment_indicator'), 'print_mode' => PresetStringColumnFactory::create('P', $label = 'print_mode'), 'beneficiary_id' => RightPaddedStringColumnFactory::create('', 20, $label = 'beneficiary_id'), 'print_advice_instruction' => PresetStringColumnFactory::create('1', $label = 'print_advice_instruction'), 'filler2' => RightPaddedStringColumnFactory::create('', 198, $label = 'filler2'), 'payer_name1' => RightPaddedStringColumnFactory::create('', 35, $label = 'payer_name1'), 'payer_name2' => RightPaddedStringColumnFactory::create('', 35, $label = 'payer_name2'), 'payer_refno' => RightPaddedStringColumnFactory::create($beneficiary->getPaymentId(), 30, $label = 'payer_refno'), 'email' => RightPaddedStringColumnFactory::create($beneficiary->getEmail(), 50, $label = 'email'), 'fax' => RightPaddedStringColumnFactory::create('', 20, $label = 'fax'), 'filler3' => RightPaddedStringColumnFactory::create('', 10, $label = 'filler3')]; $line->setColumns($columns); return $line; }