diff --git a/src/Bluesnap/Adapter.php b/src/Bluesnap/Adapter.php index 12468e7..5b959f7 100644 --- a/src/Bluesnap/Adapter.php +++ b/src/Bluesnap/Adapter.php @@ -99,7 +99,11 @@ public static function update($model, $id, $data, $options = []) $endpoint = Utility::getModelEndpoint($model, $id); $endpoint = $id_in_url ? $endpoint .'/'. $id : $endpoint; - $response = Api::put($endpoint, $data); + if($model == 'Refund') { + $response = Api::post($endpoint, $data); + } else { + $response = Api::put($endpoint, $data); + } $model = Utility::setupModel($model, $response); return new Response('success', $model); diff --git a/src/Bluesnap/Refund.php b/src/Bluesnap/Refund.php index f7b1c4a..a523449 100644 --- a/src/Bluesnap/Refund.php +++ b/src/Bluesnap/Refund.php @@ -9,7 +9,7 @@ class Refund { public static function update($id, $query_params = null) { - return Adapter::update('Refund', $id, null, [ + return Adapter::update('Refund', $id, $query_params, [ 'id_in_url' => false, 'query_params' => $query_params ]); diff --git a/src/Bluesnap/Utility.php b/src/Bluesnap/Utility.php index 0aebbd0..5aab2f3 100644 --- a/src/Bluesnap/Utility.php +++ b/src/Bluesnap/Utility.php @@ -41,7 +41,7 @@ public static function getModelEndpoint($model, $model_id = null) $models = [ 'CardTransaction' => 'transactions', 'Report' => 'report', - 'Refund' => 'transactions/'. $model_id .'/refund', + 'Refund' => 'transactions/refund/'. $model_id, 'Plan' => 'recurring/plans', 'Subscription' => 'recurring/subscriptions', 'SubscriptionCharge' => 'recurring/subscriptions/charges',