Skip to content

Commit 46476eb

Browse files
authored
Update RecurringApplicationChargeService.php
1 parent 5d7a4c6 commit 46476eb

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

lib/Service/RecurringApplicationChargeService.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function all(array $params = array())
3131
public function get($recurringApplicationChargeId, array $params = array())
3232
{
3333
$endpoint = '/admin/recurring_application_charges/'.$recurringApplicationChargeId.'.json';
34-
$request = $this->createRequest($endpoint);
35-
return $this->getNode($request, $params, RecurringApplicationCharge::class);
34+
$response = $this->request($endpoint, 'GET', $params);
35+
return $this->createObject(RecurringApplicationCharge::class, $response['recurring_application_charge']);
3636
}
3737

3838
/**
@@ -46,13 +46,10 @@ public function create(RecurringApplicationCharge &$recurringApplicationCharge)
4646
{
4747
$data = $recurringApplicationCharge->exportData();
4848
$endpoint = '/admin/recurring_application_charges.json';
49-
$request = $this->createRequest($endpoint, static::REQUEST_METHOD_POST);
50-
$response = $this->send(
51-
$request, array(
49+
$response = $this->request($endpoint, 'POST', array(
5250
'recurring_application_charge' => $data
53-
)
54-
);
55-
$recurringApplicationCharge->setData($response->recurring_application_charge);
51+
));
52+
$recurringApplicationCharge->setData($response['recurring_application_charge']);
5653
}
5754

5855
/**
@@ -65,8 +62,7 @@ public function create(RecurringApplicationCharge &$recurringApplicationCharge)
6562
public function delete(RecurringApplicationCharge $recurringApplicationCharge)
6663
{
6764
$endpoint= '/admin/recurring_application_charges/'.$recurringApplicationCharge->getId().'.json';
68-
$request = $this->createRequest($endpoint, static::REQUEST_METHOD_DELETE);
69-
$this->send($request);
65+
$response = $this->request($endpoint, 'DELETE');
7066
}
7167

7268
/**
@@ -79,8 +75,7 @@ public function delete(RecurringApplicationCharge $recurringApplicationCharge)
7975
public function activate(RecurringApplicationCharge $recurringApplicationCharge)
8076
{
8177
$endpoint = '/admin/recurring_application_charges/'.$recurringApplicationCharge->getId().'/activate.json';
82-
$request = $this->createRequest($endpoint, static::REQUEST_METHOD_POST);
83-
$response= $this->send($request);
84-
$recurringApplicationCharge->setData($response->recurring_application_charge);
78+
$response = $this->request($endpoint, 'POST');
79+
$recurringApplicationCharge->setData($response['recurring_application_charge']);
8580
}
8681
}

0 commit comments

Comments
 (0)