|
@@ -20,6 +20,13 @@ export class PayeeAddressService extends BaseService {
|
|
|
@Inject()
|
|
|
ctx;
|
|
|
|
|
|
+
|
|
|
+ @Init()
|
|
|
+ async init() {
|
|
|
+ await super.init();
|
|
|
+ this.setEntity(this.payeeAddressEntity);
|
|
|
+ }
|
|
|
+
|
|
|
private _isOpenApi: boolean = false
|
|
|
|
|
|
setIsOpenApi(payload = false) {
|
|
@@ -58,17 +65,32 @@ export class PayeeAddressService extends BaseService {
|
|
|
return params;
|
|
|
}
|
|
|
async delete(params: any) {
|
|
|
+ if (this.ctx.admin?.openApi) {
|
|
|
+ const payee = await this.payeeAddressEntity.findOneBy({
|
|
|
+ beneficiary_address_id: params.id,
|
|
|
+ });
|
|
|
+ const res = await this.paymentService
|
|
|
+ .setChannel(params.channel || 'SUNPAY')
|
|
|
+ .deleteBeneficiaryAddress(params);
|
|
|
+ try{
|
|
|
+ payee && await super.delete([payee.id]);
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ return res
|
|
|
+ }
|
|
|
const payee = await this.payeeAddressEntity.findOneBy({
|
|
|
id: params.id,
|
|
|
});
|
|
|
if (payee.beneficiary_address_id) {
|
|
|
- await this.paymentService
|
|
|
+ const res = await this.paymentService
|
|
|
.setChannel(payee.channel)
|
|
|
.deleteBeneficiaryAddress({
|
|
|
id: payee.beneficiary_address_id,
|
|
|
});
|
|
|
+ await super.delete(params);
|
|
|
+ return res;
|
|
|
}
|
|
|
- await super.delete(params);
|
|
|
}
|
|
|
async list(params: any, option: any, connectionName?: any) {
|
|
|
const { channel, currency } = params;
|