Add remaining project files (exclude ignored folders)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Midtrans\utility;
|
||||
|
||||
class MtFixture
|
||||
{
|
||||
protected static function readFixture($filename)
|
||||
{
|
||||
$charge_json = file_get_contents(__DIR__ . '/fixture/' . $filename);
|
||||
$charge_template_params = json_decode($charge_json, true);
|
||||
$charge_template_params['transaction_details']['order_id'] = rand();
|
||||
return $charge_template_params;
|
||||
}
|
||||
}
|
||||
|
||||
class MtChargeFixture extends MtFixture
|
||||
{
|
||||
public static function build($payment_type, $payment_data = null)
|
||||
{
|
||||
$charge_params = self::readFixture('mt_charge.json');
|
||||
|
||||
if (!is_null($payment_type)) {
|
||||
$charge_params['payment_type'] = $payment_type;
|
||||
}
|
||||
|
||||
if (!is_null($payment_data)) {
|
||||
$charge_params[$payment_type] = $payment_data;
|
||||
}
|
||||
return $charge_params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"transaction_details": {
|
||||
"order_id": "C17550",
|
||||
"gross_amount": 145000
|
||||
},
|
||||
|
||||
"item_details" : [
|
||||
{
|
||||
"id": "a1",
|
||||
"price": 50000,
|
||||
"quantity": 2,
|
||||
"name": "Apel"
|
||||
},
|
||||
{
|
||||
"id": "a2",
|
||||
"price": 45000,
|
||||
"quantity": 1,
|
||||
"name": "Jeruk"
|
||||
}
|
||||
],
|
||||
"customer_details": {
|
||||
"first_name": "Andri",
|
||||
"last_name": "Litani",
|
||||
"email": "andri@litani.com",
|
||||
"phone": "081122334455",
|
||||
"billing_address": {
|
||||
"first_name": "Andri",
|
||||
"last_name": "Litani",
|
||||
"address": "Mangga 20",
|
||||
"city": "Jakarta",
|
||||
"postal_code": "16602",
|
||||
"phone": "081122334455",
|
||||
"country_code": "IDN"
|
||||
},
|
||||
"shipping_address": {
|
||||
"first_name": "Obet",
|
||||
"last_name": "Supriadi",
|
||||
"address": "Manggis 90",
|
||||
"city": "Jakarta",
|
||||
"postal_code": "16601",
|
||||
"phone": "08113366345",
|
||||
"country_code": "IDN"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user