Skip to content

Commit 59f0fad

Browse files
committed
Mapping added
1 parent 0cd0e01 commit 59f0fad

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/Api/PayoutBundle/Library/Intermex.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Intermex
1414
protected $service_id;
1515
protected $operationMap = array(
1616
'create' => 'altaEnvioT',
17-
'modify' => '',
18-
'update' => '',
19-
'cancel' => ''
17+
'modify' => 'processUpdate',
18+
'update' => 'processUpdate',
19+
'cancel' => 'anulaEnvio'
2020
);
2121

2222
public function __construct(ContainerInterface $container)
@@ -472,9 +472,34 @@ public function confirmaCambio($iIdOrden=null)
472472
return $arr;
473473
}
474474

475+
475476
public function process($operation, $args)
476477
{
477478
return call_user_func_array(array($this, $this->operationMap[$operation]), [$args]);
478479
}
479480

481+
/**
482+
* Used to map to specific update method according to
483+
* modified data
484+
*
485+
* @param Array $txn [fields must be('refNo','newData','reason for change')]
486+
* @return void
487+
*/
488+
public function processUpdate($txn=null)
489+
{
490+
if(isset($txn['receiver_first_name']))
491+
{
492+
$this->cambiaBeneficiario($txn['confirmation_number'],$txn['receiver_first_name'],$txn['reason']);
493+
}
494+
if(isset($txn['sender_first_name']))
495+
{
496+
$this->cambiaRemitente($txn['confirmation_number'],$txn['sender_first_name'],$txn['reason']);
497+
}
498+
if(isset($txn['sender_phone_mobile']))
499+
{
500+
$this->cambiaTelBeneficiario($txn['confirmation_number'],$txn['sender_phone_mobile'],$txn['reason']);
501+
}
502+
503+
}
504+
480505
}

0 commit comments

Comments
 (0)