public function approve() { Veritrans_Config::$serverKey = "VT-server-tHdPoLZ5B9msOwJBt-tN7jOE"; Veritrans_Config::$isProduction = false; $order_id = "1462720684"; try { $response = Veritrans_Transaction::approve($order_id); pr($response); } catch (Exception $e) { echo $e->getMessage(); die; } }
public function testApprove() { VT_Tests::$stubHttp = true; VT_Tests::$stubHttpResponse = '{ "status_code": "200", "status_message": "Success, transaction is approved", "transaction_id": "2af158d4-b82e-46ac-808b-be19aaa96ce3", "masked_card": "451111-1117", "order_id": "Order-111", "payment_type": "credit_card", "transaction_time": "2014-11-27 10:05:10", "transaction_status": "capture", "fraud_status": "accept", "approval_code": "1416550071152", "bank": "bni", "gross_amount": "10000.00" }'; $approve = Veritrans_Transaction::approve("Order-111"); $this->assertEquals($approve, "200"); $this->assertEquals(VT_Tests::$lastHttpRequest["url"], "https://api.sandbox.veritrans.co.id/v2/Order-111/approve"); $fields = VT_Tests::lastReqOptions(); $this->assertEquals($fields["POST"], 1); $this->assertEquals($fields["POSTFIELDS"], null); }