update account mapping

This commit is contained in:
edmondlang
2023-07-18 16:34:19 +08:00
parent 726ea70f75
commit dfd870b590
3 changed files with 14 additions and 12 deletions
@@ -93,6 +93,10 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic
if (in_array($systemReference, ['exchange', 'izyim'])) {
$transaction = $this->checksBillNumber->execute($transactionReference, $systemReference);
if (!count($transaction)) {
throw new MalformedRequestException('Transaction Not Found.');
}
if($systemReference === 'exchange') {
$owner_type = Transaction::class;
$owner_id = $transaction->id;
@@ -113,7 +117,7 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic
if (($payFor === 'sales' && !in_array($transactionType, [ShippingTransactionType::PAYMENT, ShippingTransactionType::GROUP_PAYMENT]))
|| ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP]))) {
throw new Exception("Transaction Type does not match");
throw new MalformedRequestException('Transaction Type does not match.');
}
$owner_type = Transaction::class;
@@ -113,6 +113,7 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' Fetch Shipping Transaction Fail ' . json_encode([
'id' => $transaction->owner_id,
'with_company' => true,
'StatementTransactionOwner_id' => $transaction->id,
]) . PHP_EOL;
file_put_contents($errorFilePath, $textToAppend, FILE_APPEND);
@@ -53,6 +53,7 @@
</div>
</div>
</div>
<p class="text-danger fs-9">{{ error }}</p>
<div class="row">
<div class="col">
<div class="row">
@@ -60,7 +61,7 @@
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
</div>
<div class="col p-l-5">
<div data-dismiss="modal" class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update</div>
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update</div>
</div>
</div>
</div>
@@ -71,7 +72,7 @@
<script>
import componentHandler from '../../../general/mixins/componentHandler';
// import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
// import FormHandler from '../../../general/mixins/formHandler';
import { required } from "vuelidate/lib/validators";
@@ -110,20 +111,16 @@
},
methods: {
submitForm(){
this.pay_for_value = this.pay_for_value.replace(/\s/g, "_").toLowerCase();
this.system_references = this.system_references ? this.system_references.toLowerCase() : '';
this.parameters = {
pay_for : this.pay_for_value,
system_references : this.system_references,
pay_for : this.pay_for_value.replace(/\s/g, "_").toLowerCase(),
system_references : this.system_references ? this.system_references.toLowerCase() : '',
transaction_reference : this.transaction_reference
};
this.submit(this.route('api.accounting.statement.details.update', this.data.id), 'put', this.section, true, true);
},
successHandler(){
// this.closeModal();
// this.formHandler('');
errorHandler(error){
this.error = error.message;
},
customOptions(){
switch (this.pay_for_value) {
@@ -136,6 +133,6 @@
}
},
},
mixins: [componentHandler]
mixins: [componentHandler, ModalFormHandler]
}
</script>