Skip to content

Commit

Permalink
removed payment create method to avoid its use (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoa48 authored and ecleel committed Mar 19, 2019
1 parent 1c564cf commit f520cb4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 51 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moyasar",
"version": "0.5.0",
"version": "0.5.1",
"description": "Moyasar node SDK",
"main": "lib/moyasar.js",
"scripts": {
Expand Down
7 changes: 0 additions & 7 deletions src/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ export default class extends Service {

}

create(receipt){
receipt.source.number = String(receipt.source.number);
return this.sendRequest('payments','POST',receipt).then(res=>{
return res;
})
}

update(payment){
if (typeof payment.id != "string") {
throw new Error('Payment object does not have id');
Expand Down
43 changes: 0 additions & 43 deletions test/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,49 +68,6 @@ describe('Payment API', () => {
});
});

it('Make a payment', done => {
fakeServer.post('/payments').basicAuth(basicAuth).reply(200, {
"id": "27607a32-c968-40f3-9eb9-7838d906f791",
"status": "paid",
"amount": 7000,
"fee": 0,
"currency": "SAR",
"refunded": 0,
"refunded_at": null,
"description": "bag payment",
"amount_format": "70.00 SAR",
"fee_format": "0.00 SAR",
"invoice_id": null,
"ip": null,
"created_at": "2016-03-21T19:25:35.093Z",
"updated_at": "2016-03-21T19:25:35.093Z",
"source": {
"type": "creditcard",
"company": "visa",
"name": "Abdulaziz Nasser",
"number": "XXXX-XXXX-XXXX-1111",
"message": null
}
});
moyasar.payment.create({
amount: 7000,
currency: 'SAR',
description: 'bag payment',
source: {
type: "creditcard",
company: "visa",
name: "Abdulaziz Nasser",
number: "XXXX-XXXX-XXXX-1111",
message: null
}
}).then(p => {
assert.ok(p.id);
done();
fakeServer.isDone();
});

});

it('Retreive a payment ', done => {
fakeServer.get('/payments/d256ac99-ada1-5ef3-ab00-8e837b54ad5f').basicAuth(basicAuth).reply(200, {
"id": "d256ac99-ada1-5ef3-ab00-8e837b54ad5f",
Expand Down

0 comments on commit f520cb4

Please sign in to comment.