Commit f7015bf5 authored by Ivan Belitskii's avatar Ivan Belitskii

Add profile access methods

parent 211e0863
...@@ -19,21 +19,13 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi { ...@@ -19,21 +19,13 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi {
} }
public function pay(array $customerData, array $paymentData) { public function pay(array $customerData, array $paymentData) {
$customer = [ $customer = array_only($customerData, ['id']);
'id' => $customerData['id']
]; $payment = array_only($paymentData, [
'card_identifier', 'merchantSessionKey', 'description',
$payment = [ 'type', 'amount', 'currency', 'save_card', 'applicationAlias',
'card_identifier' => $paymentData['card_identifier'], ]);
'merchantSessionKey' => $paymentData['merchant_session_key'],
'description' => $paymentData['payment_type'],
'type' => $paymentData['payment_type'],
'amount' => $paymentData['amount'],
'currency' => $paymentData['currency'],
'save_card' => $paymentData['save_data'],
'applicationAlias' => $paymentData['application_alias']
];
return $this->request('POST', 'pay', [ return $this->request('POST', 'pay', [
'customer' => $customer, 'customer' => $customer,
'payment' => $payment, 'payment' => $payment,
...@@ -43,4 +35,20 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi { ...@@ -43,4 +35,20 @@ class DqBilling extends \Staskjs\SimpleApi\SimpleJsonApi {
public function getPaymentSession() { public function getPaymentSession() {
return $this->request('GET', 'payment_session'); return $this->request('GET', 'payment_session');
} }
public function getClientProfiles($urn) {
return $this->request('GET', 'customers', ['urn' => $urn]);
}
public function getProfilePaymentCards($customerId) {
return $this->request('GET', "customers/{$customerId}/cards");
}
public function saveProfile(array $profile) {
$profileData = array_only($profile, [
'urn', 'first_name', 'last_name', 'address_1', 'address_2',
'country', 'city', 'postal_code', 'state', 'id'
]);
return $this->request('POST', 'customers', $profileData);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment