@@ -31,8 +31,8 @@ public function all(array $params = array())
31
31
public function get ($ recurringApplicationChargeId , array $ params = array ())
32
32
{
33
33
$ 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 ' ] );
36
36
}
37
37
38
38
/**
@@ -46,13 +46,10 @@ public function create(RecurringApplicationCharge &$recurringApplicationCharge)
46
46
{
47
47
$ data = $ recurringApplicationCharge ->exportData ();
48
48
$ 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 (
52
50
'recurring_application_charge ' => $ data
53
- )
54
- );
55
- $ recurringApplicationCharge ->setData ($ response ->recurring_application_charge );
51
+ ));
52
+ $ recurringApplicationCharge ->setData ($ response ['recurring_application_charge ' ]);
56
53
}
57
54
58
55
/**
@@ -65,8 +62,7 @@ public function create(RecurringApplicationCharge &$recurringApplicationCharge)
65
62
public function delete (RecurringApplicationCharge $ recurringApplicationCharge )
66
63
{
67
64
$ 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 ' );
70
66
}
71
67
72
68
/**
@@ -79,8 +75,7 @@ public function delete(RecurringApplicationCharge $recurringApplicationCharge)
79
75
public function activate (RecurringApplicationCharge $ recurringApplicationCharge )
80
76
{
81
77
$ 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 ' ]);
85
80
}
86
81
}
0 commit comments