/** * @group integration */ public function testCallMerchantAliasCreation() { return true; /* Creating the WebService main object */ $test = new CreateMerchantAlias(); /* Creating the WebService message object */ $testArgument = new CreateMerchantAliasRequest(); /* Setting the parameters */ $testAlias = new Alias(); $testAlias->setAliasName("351#911521624"); $testAlias->setAliasTypeCde(Alias::CELLPHONE); $testArgument->setAlias($testAlias); $testMerchant = new Merchant(); $testMerchant->setIPAddress($this->getConfig()->getMerchantIP())->setPosId($this->getConfig()->getMerchantPosId()); $testArgument->setMerchant($testMerchant); $testMsgProps = new MessageProperties(); $testMsgProps->setChannel("01"); $testMsgProps->setChannelTypeCode("VPOS"); $testMsgProps->setNetworkCode("MULTIB"); $merchantTimestamp = date_create("2014-09-28"); $testMsgProps->setTimestamp($merchantTimestamp); $testMsgProps->setServiceType("01"); $testMsgProps->setApiVersion("1"); $testArgument->setMessageProperties($testMsgProps); $testNewAlias = new Alias(); $testNewAlias->setAliasName("mykubo-mbway-1234567891234"); $testNewAlias->setAliasTypeCde(Alias::GENERIC); $testArgument->setNewAlias($testNewAlias); $test->setArg0($testArgument); $service = new MBWayClient($this->getConfig()); $service->setSandbox(true); $response = $service->createMerchantAlias($test); $return = $response->getReturn(); //Return 124 because merchant didn't make any purchase before $this->assertSame("124", $return->getStatusCode()); }
/** * @group integration * @dataProvider requestProvider * @param RequestFinancialOperationRequest $request */ public function testPurchaseAfterAuthorization(RequestFinancialOperationRequest $request) { if (MBWAY_MERCHANT_OPERATION_TO_PURCHASE_AFTER_AUTHORIZE === '') { return $this->assertTrue(true); } $oprid = uniqid(); $amountAuthorized = 70; $amountToPurchase = 20; $currency = "9782"; $test = new RequestFinancialOperation(); $operation = new FinancialOperation(); $operation->setAmount($amountAuthorized)->setCurrencyCode($currency)->setMerchantOprId(MBWAY_MERCHANT_OPERATION_TO_PURCHASE_AFTER_AUTHORIZE)->setOperationTypeCode(FinancialOperation::PURCHASE_AUTHORIZATION); $operationPurchaseAfterAuthorize = new FinancialOperation(); $operationPurchaseAfterAuthorize->setAmount($amountToPurchase)->setCurrencyCode($currency)->setMerchantOprId($oprid)->setOperationTypeCode(FinancialOperation::PURCHASE_AFTER_AUTHORIZATION); $request->setFinancialOperation($operationPurchaseAfterAuthorize); $request->setReferencedFinancialOperation($operation); $test->setArg0($request); $service = new MBWayClient($this->getConfig()); $service->setSandbox(true); $response = $service->requestFinancialOperation($test); $return = $response->getReturn(); $this->assertSame($amountToPurchase, $return->getAmount()); $this->assertSame($oprid, $return->getMerchantOperationID()); $this->assertSame($currency, $return->getCurrencyCode()); $this->assertTrue($return->isValid()); $this->assertNotEmpty($return->getTimestamp()); }